opener-constituent-parser-base 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8daa009b3c65632398a5b77dbbe75e6c4d38968c
4
- data.tar.gz: 4e446f65248f01b84bd82e666542272b2c22fef7
3
+ metadata.gz: 7cea461781745e066d66b104bdcfe5c5d53dd866
4
+ data.tar.gz: f862a286290a066bb2772a11c1ba295811331818
5
5
  SHA512:
6
- metadata.gz: afabc3b04933f70e811278cb4fee2460c19cebf591779db2358310c79920578e28905bc15b633756035a13ebbc2907bbdfdb364cfa75be9c606d190f9807c508
7
- data.tar.gz: 1a6ae1e2eff88c2e918ef57a0e7a13176f6ee7a8eedd122b1199e179b588d8f00efcfc6d070f4c4a6a179829eb05e0556c9647d9093aaefdbf6c88e733911efc
6
+ metadata.gz: e7bee1ad41b8e61aeb00e16a738f92ae9cedd852a5b76460f7af1d8d6d7fff1850383c535b273a5f2e633dd681d7c2c1b5766b08c63969b9a5afbe9179d83c07
7
+ data.tar.gz: 865bd41ff6d1e40954ea77b7bc4eefbca4848d3049379ece341eae0d3b1644a3b45c03b3150c944aa584fe3a73bb8944f1c100d02fc47d37e283d7606bfe47e6
@@ -5,4 +5,6 @@ require_relative '../lib/opener/constituent_parsers/base'
5
5
  kernel = Opener::ConstituentParsers::Base.new(:args => ARGV, :language => 'en')
6
6
  input = STDIN.tty? ? nil : STDIN.read
7
7
 
8
- kernel.run!(input)
8
+ output = kernel.run(input)
9
+
10
+ puts output
@@ -5,4 +5,8 @@ require_relative '../lib/opener/constituent_parsers/base'
5
5
  kernel = Opener::ConstituentParsers::Base.new(:args => ARGV, :language => 'es')
6
6
  input = STDIN.tty? ? nil : STDIN.read
7
7
 
8
- kernel.run!(input)
8
+ output = kernel.run(input)
9
+
10
+ puts output
11
+
12
+
@@ -5,4 +5,6 @@ require_relative '../lib/opener/constituent_parsers/base'
5
5
  kernel = Opener::ConstituentParsers::Base.new(:args => ARGV, :language => 'fr')
6
6
  input = STDIN.tty? ? nil : STDIN.read
7
7
 
8
- kernel.run!(input)
8
+ output = kernel.run(input)
9
+
10
+ puts output
@@ -5,4 +5,6 @@ require_relative '../lib/opener/constituent_parsers/base'
5
5
  kernel = Opener::ConstituentParsers::Base.new(:args => ARGV, :language => 'it')
6
6
  input = STDIN.tty? ? nil : STDIN.read
7
7
 
8
- kernel.run!(input)
8
+ output = kernel.run(input)
9
+
10
+ puts output
Binary file
@@ -31,6 +31,8 @@ module Opener
31
31
  # @return [String]
32
32
  #
33
33
  DEFAULT_LANGUAGE = 'en'.freeze
34
+
35
+ ACCEPTED_LANGUAGES = ['en', 'es', 'it', 'fr'].freeze
34
36
 
35
37
  ##
36
38
  # Hash containing the default options to use.
@@ -64,20 +66,24 @@ module Opener
64
66
  # @return [Array]
65
67
  #
66
68
  def run(input)
67
- input = StringIO.new(input) unless input.kind_of?(IO)
68
- annotator = Java::ehu.parse.Annotate.new(language)
69
- reader = InputStreamReader.new(input.to_inputstream)
70
- kaf = KAFDocument.create_from_stream(reader)
71
- kaf.add_linguistic_processor("constituents","ehu-parse-"+language,"now","1.0")
69
+ if ACCEPTED_LANGUAGES.include?(language)
70
+ input = StringIO.new(input) unless input.kind_of?(IO)
71
+ annotator = Java::ehu.parse.Annotate.new(language)
72
+ reader = InputStreamReader.new(input.to_inputstream)
73
+ kaf = KAFDocument.create_from_stream(reader)
74
+ kaf.add_linguistic_processor("constituents","ehu-parse-"+language,"now","1.0")
72
75
 
73
- if heads?
74
- head_finder = CollinsHeadFinder.new(language)
75
- annotator.parseWithHeads(kaf, head_finder)
76
+ if heads?
77
+ head_finder = CollinsHeadFinder.new(language)
78
+ annotator.parseWithHeads(kaf, head_finder)
79
+ else
80
+ annotator.parse(kaf)
81
+ end
82
+
83
+ return kaf.to_string
76
84
  else
77
- annotator.parse(kaf)
85
+ return input
78
86
  end
79
-
80
- return kaf.to_string
81
87
  end
82
88
  #
83
89
  ##
@@ -1,7 +1,7 @@
1
1
  module Opener
2
2
  module ConstituentParsers
3
3
  class Base
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.2'
5
5
  end # Base
6
6
  end # ConstituentParsers
7
7
  end # Opener
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opener-constituent-parser-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - development@olery.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-19 00:00:00.000000000 Z
11
+ date: 2014-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opener-build-tools
@@ -69,22 +69,22 @@ dependencies:
69
69
  description: Constituent parser that supports various languages.
70
70
  email:
71
71
  executables:
72
- - constituent-parser-fr
73
72
  - constituent-parser-en
74
73
  - constituent-parser-es
74
+ - constituent-parser-fr
75
75
  - constituent-parser-it
76
76
  extensions: []
77
77
  extra_rdoc_files: []
78
78
  files:
79
- - core/target/ehu-parse-1.0.jar
80
- - lib/opener/constituent_parsers/base.rb
81
- - lib/opener/constituent_parsers/base/version.rb
82
- - opener-constituent-parser-base.gemspec
83
79
  - README.md
84
- - bin/constituent-parser-fr
85
80
  - bin/constituent-parser-en
86
81
  - bin/constituent-parser-es
82
+ - bin/constituent-parser-fr
87
83
  - bin/constituent-parser-it
84
+ - core/target/ehu-parse-1.0.jar
85
+ - lib/opener/constituent_parsers/base.rb
86
+ - lib/opener/constituent_parsers/base/version.rb
87
+ - opener-constituent-parser-base.gemspec
88
88
  homepage:
89
89
  licenses: []
90
90
  metadata: {}
@@ -104,9 +104,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 2.1.9
107
+ rubygems_version: 2.2.2
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: Constituent parser that supports various languages.
111
111
  test_files: []
112
- has_rdoc: yard