opener-pos-tagger 3.1.2 → 3.1.3

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: f0a988065a02c5ec5564d3173a9b53d03660df4c
4
- data.tar.gz: 5834c61a5eb02f7dc8419658860d30809b800e01
3
+ metadata.gz: fe5081b4df7ce9e503439f31db267cf9a344144f
4
+ data.tar.gz: 4ea5c19b9ff12d629166f31853012a559a2f5756
5
5
  SHA512:
6
- metadata.gz: 5e84d5259786f2d7a4e1663cdf77cd040d916152a9e182a6fdbdfa9314b19648cb5996a8764b9b11984e47b4d6e7146d23c6ae5ccba1dac18f74a5b1008b1d49
7
- data.tar.gz: 6726e506d70d35ce297e706f88edf210e5587cdcc7261392e94793da9a854f61dbc2b0caca97a1987e33dfeb65cf89bcecd4e71e40bb0af3f20b37870c603ade
6
+ metadata.gz: 3405413de4b5af3fa69de8f245c96adb10bd25df6a54c7aa30c556f7af149210ea84becb2b30420038955841bf88f879f3a82063a184e9042afea1cc0a26bc8c
7
+ data.tar.gz: d062352fc0dce0256d282097e1f76f1c8ac9c1e94047bfeb112831f70dab4f7a2725e8e657369050ec10ee252c968aaf1fc05ea31c1565e7d57cb61014369860
@@ -1,7 +1,10 @@
1
+ require 'open3'
2
+
3
+ require 'opener/core'
1
4
  require 'opener/pos_taggers/base'
2
5
  require 'opener/pos_taggers/en'
6
+
3
7
  require 'nokogiri'
4
- require 'open3'
5
8
  require 'slop'
6
9
 
7
10
  require_relative 'pos_tagger/version'
@@ -47,8 +50,8 @@ module Opener
47
50
  def run(input)
48
51
  language = language_from_kaf(input)
49
52
 
50
- unless valid_language?(language)
51
- raise ArgumentError, "The specified language (#{language}) is invalid"
53
+ if !language or !valid_language?(language)
54
+ raise Core::UnsupportedLanguageError, language
52
55
  end
53
56
 
54
57
  kernel = language_constant(language).new(:args => options[:args])
@@ -58,20 +61,22 @@ module Opener
58
61
 
59
62
  alias tag run
60
63
 
61
- protected
62
-
63
64
  ##
64
- # Extracts the language from a KAF document.
65
+ # Extracts the language from a KAF document, returns `nil` if no language
66
+ # was found.
65
67
  #
66
68
  # @param [String] input
67
69
  # @return [String]
68
70
  #
69
71
  def language_from_kaf(input)
70
- reader = Nokogiri::XML::Reader(input)
72
+ document = Nokogiri::XML(input)
73
+ language = document.xpath('KAF/@xml:lang')[0]
71
74
 
72
- return reader.read.lang
75
+ return language ? language.to_s : nil
73
76
  end
74
77
 
78
+ private
79
+
75
80
  ##
76
81
  # @param [String] language
77
82
  # @return [Class]
@@ -1,5 +1,5 @@
1
1
  module Opener
2
2
  class POSTagger
3
- VERSION = '3.1.2'
3
+ VERSION = '3.1.3'
4
4
  end
5
5
  end
@@ -28,13 +28,12 @@ Gem::Specification.new do |gem|
28
28
 
29
29
  gem.add_dependency 'opener-webservice', '~> 2.0'
30
30
  gem.add_dependency 'opener-daemons', '~> 2.1'
31
- gem.add_dependency 'opener-core', '~> 2.0'
31
+ gem.add_dependency 'opener-core', '~> 2.3'
32
32
 
33
33
  gem.add_dependency 'nokogiri'
34
34
  gem.add_dependency 'slop', '~> 3.5'
35
35
 
36
36
  gem.add_development_dependency 'rspec'
37
- gem.add_development_dependency 'cucumber'
38
37
  gem.add_development_dependency 'pry'
39
38
  gem.add_development_dependency 'rake'
40
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opener-pos-tagger
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 3.1.3
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-12-01 00:00:00.000000000 Z
11
+ date: 2014-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opener-pos-tagger-base
@@ -84,12 +84,12 @@ dependencies:
84
84
  requirements:
85
85
  - - ~>
86
86
  - !ruby/object:Gem::Version
87
- version: '2.0'
87
+ version: '2.3'
88
88
  requirement: !ruby/object:Gem::Requirement
89
89
  requirements:
90
90
  - - ~>
91
91
  - !ruby/object:Gem::Version
92
- version: '2.0'
92
+ version: '2.3'
93
93
  prerelease: false
94
94
  type: :runtime
95
95
  - !ruby/object:Gem::Dependency
@@ -134,20 +134,6 @@ dependencies:
134
134
  version: '0'
135
135
  prerelease: false
136
136
  type: :development
137
- - !ruby/object:Gem::Dependency
138
- name: cucumber
139
- version_requirements: !ruby/object:Gem::Requirement
140
- requirements:
141
- - - '>='
142
- - !ruby/object:Gem::Version
143
- version: '0'
144
- requirement: !ruby/object:Gem::Requirement
145
- requirements:
146
- - - '>='
147
- - !ruby/object:Gem::Version
148
- version: '0'
149
- prerelease: false
150
- type: :development
151
137
  - !ruby/object:Gem::Dependency
152
138
  name: pry
153
139
  version_requirements: !ruby/object:Gem::Requirement