Class: Opener::POSTaggers::FR
- Inherits:
-
Object
- Object
- Opener::POSTaggers::FR
- Defined in:
- lib/opener/pos_taggers/fr.rb,
lib/opener/pos_taggers/fr/version.rb
Overview
The POS tagger that supports French.
Constant Summary collapse
- VERSION =
"1.0.0"
Instance Attribute Summary collapse
- #args ⇒ Array readonly
- #options ⇒ Hash readonly
Instance Method Summary collapse
-
#command ⇒ String
Builds the command used to execute the kernel.
-
#initialize(options = {}) ⇒ FR
constructor
A new instance of FR.
-
#run(input) ⇒ Array
Runs the command and returns the output of STDOUT, STDERR and the process information.
Constructor Details
#initialize(options = {}) ⇒ FR
Returns a new instance of FR.
23 24 25 26 |
# File 'lib/opener/pos_taggers/fr.rb', line 23 def initialize( = {}) @args = .delete(:args) || [] @options = end |
Instance Attribute Details
#args ⇒ Array (readonly)
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/opener/pos_taggers/fr.rb', line 14 class FR attr_reader :args, :options ## # @param [Hash] options # # @option options [Array] :args The commandline arguments to pass to the # underlying Python script. # def initialize( = {}) @args = .delete(:args) || [] @options = end ## # Builds the command used to execute the kernel. # # @return [String] # def command "java -jar #{kernel} -l #{lang} #{args.join(' ')}" end ## # Runs the command and returns the output of STDOUT, STDERR and the # process information. # # @param [String] input The input to tag. # @return [Array] # def run(input) return Open3.capture3(command, :stdin_data => input) end protected ## # @return [String] # def core_dir File.("../../../core", File.dirname(__FILE__)) end ## # @return [String] # def kernel core_dir+'/target/Vicom-postagger_FR-0.9.jar' end def lang 'fr' end end |
#options ⇒ Hash (readonly)
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/opener/pos_taggers/fr.rb', line 14 class FR attr_reader :args, :options ## # @param [Hash] options # # @option options [Array] :args The commandline arguments to pass to the # underlying Python script. # def initialize( = {}) @args = .delete(:args) || [] @options = end ## # Builds the command used to execute the kernel. # # @return [String] # def command "java -jar #{kernel} -l #{lang} #{args.join(' ')}" end ## # Runs the command and returns the output of STDOUT, STDERR and the # process information. # # @param [String] input The input to tag. # @return [Array] # def run(input) return Open3.capture3(command, :stdin_data => input) end protected ## # @return [String] # def core_dir File.("../../../core", File.dirname(__FILE__)) end ## # @return [String] # def kernel core_dir+'/target/Vicom-postagger_FR-0.9.jar' end def lang 'fr' end end |
Instance Method Details
#command ⇒ String
Builds the command used to execute the kernel.
33 34 35 |
# File 'lib/opener/pos_taggers/fr.rb', line 33 def command "java -jar #{kernel} -l #{lang} #{args.join(' ')}" end |
#run(input) ⇒ Array
Runs the command and returns the output of STDOUT, STDERR and the process information.
44 45 46 |
# File 'lib/opener/pos_taggers/fr.rb', line 44 def run(input) return Open3.capture3(command, :stdin_data => input) end |