Class: Opener::Coreference
- Inherits:
-
Object
- Object
- Opener::Coreference
- Defined in:
- lib/opener/coreference.rb,
lib/opener/coreference/cli.rb,
lib/opener/coreference/server.rb,
lib/opener/coreference/version.rb
Defined Under Namespace
Constant Summary collapse
- DEFAULT_OPTIONS =
Hash containing the default options to use.
{ :args => [], }.freeze
- VERSION =
'2.0.1'
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Coreference
constructor
A new instance of Coreference.
-
#run(input) ⇒ String
Processes the input KAF document and returns a new KAF document containing the results.
Constructor Details
#initialize(options = {}) ⇒ Coreference
Returns a new instance of Coreference.
27 28 29 |
# File 'lib/opener/coreference.rb', line 27 def initialize( = {}) @options = DEFAULT_OPTIONS.merge() end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/opener/coreference.rb', line 10 def @options end |
Instance Method Details
#run(input) ⇒ String
Processes the input KAF document and returns a new KAF document containing the results.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/opener/coreference.rb', line 38 def run(input) language = language_from_kaf(input) args = [:args].dup if language and language_constant_defined?(language) kernel = language.new(:args => args) else kernel = Coreferences::Base.new(:args => args, :language => language) end stdout, stderr, process = kernel.run(input) raise stderr unless process.success? return stdout end |