opener-pos-tagger 2.1.6 → 2.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/opener/pos_tagger.rb +1 -2
- data/lib/opener/pos_tagger/version.rb +1 -1
- data/lib/opener/pos_tagger/views/index.erb +1 -1
- data/opener-pos-tagger.gemspec +1 -0
- metadata +26 -14
- data/lib/opener/pos_tagger/error_layer.rb +0 -89
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9f86de19b2225e0852afe889d2178f37b61c11d
|
4
|
+
data.tar.gz: f58affaa81f0f2c1643c8ebbdbe44206a48a34db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f92ae851b910e42ef3aa61a5d63c359891ae815b444fef6064d7dbd45f35d74baf65679dec342cad599d2f8a6324a8c5389b8c3c147b7a203ebf257bc67e11e
|
7
|
+
data.tar.gz: 805c1f697ad5915dc84e01a89f03d2a21107db990751caba9da7b77daa95d9fd6534f5a89567a18f30de91c1bf6282d31ee37446be6bf3fe487df3a349f009a0
|
data/lib/opener/pos_tagger.rb
CHANGED
@@ -6,7 +6,6 @@ require 'optparse'
|
|
6
6
|
|
7
7
|
require_relative 'pos_tagger/version'
|
8
8
|
require_relative 'pos_tagger/cli'
|
9
|
-
require_relative 'pos_tagger/error_layer'
|
10
9
|
|
11
10
|
module Opener
|
12
11
|
##
|
@@ -57,7 +56,7 @@ module Opener
|
|
57
56
|
|
58
57
|
return kernel.run(input)
|
59
58
|
rescue Exception => error
|
60
|
-
return ErrorLayer.new(input, error.message, self.class).add
|
59
|
+
return Opener::Core::ErrorLayer.new(input, error.message, self.class).add
|
61
60
|
end
|
62
61
|
end
|
63
62
|
|
data/opener-pos-tagger.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |gem|
|
|
29
29
|
gem.add_dependency 'httpclient'
|
30
30
|
gem.add_dependency 'puma'
|
31
31
|
gem.add_dependency 'opener-daemons'
|
32
|
+
gem.add_dependency 'opener-core', '~>1.0'
|
32
33
|
|
33
34
|
gem.add_development_dependency 'rspec'
|
34
35
|
gem.add_development_dependency 'cucumber'
|
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: 2.1.
|
4
|
+
version: 2.1.7
|
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-06-
|
11
|
+
date: 2014-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opener-pos-tagger-base
|
@@ -128,6 +128,20 @@ dependencies:
|
|
128
128
|
version: '0'
|
129
129
|
prerelease: false
|
130
130
|
type: :runtime
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: opener-core
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ~>
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '1.0'
|
138
|
+
requirement: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ~>
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '1.0'
|
143
|
+
prerelease: false
|
144
|
+
type: :runtime
|
131
145
|
- !ruby/object:Gem::Dependency
|
132
146
|
name: rspec
|
133
147
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -187,27 +201,26 @@ dependencies:
|
|
187
201
|
description: Gem that wraps up the different existing pos-taggers
|
188
202
|
email:
|
189
203
|
executables:
|
190
|
-
- pos-tagger-server
|
191
204
|
- pos-tagger
|
192
205
|
- pos-tagger-daemon
|
206
|
+
- pos-tagger-server
|
193
207
|
extensions: []
|
194
208
|
extra_rdoc_files: []
|
195
209
|
files:
|
210
|
+
- README.md
|
211
|
+
- bin/pos-tagger
|
212
|
+
- bin/pos-tagger-daemon
|
213
|
+
- bin/pos-tagger-server
|
214
|
+
- config.ru
|
215
|
+
- exec/pos-tagger.rb
|
196
216
|
- lib/opener/pos_tagger.rb
|
197
|
-
- lib/opener/pos_tagger/version.rb
|
198
|
-
- lib/opener/pos_tagger/server.rb
|
199
217
|
- lib/opener/pos_tagger/cli.rb
|
200
|
-
- lib/opener/pos_tagger/error_layer.rb
|
201
218
|
- lib/opener/pos_tagger/public/markdown.css
|
219
|
+
- lib/opener/pos_tagger/server.rb
|
220
|
+
- lib/opener/pos_tagger/version.rb
|
202
221
|
- lib/opener/pos_tagger/views/index.erb
|
203
222
|
- lib/opener/pos_tagger/views/result.erb
|
204
|
-
- config.ru
|
205
223
|
- opener-pos-tagger.gemspec
|
206
|
-
- README.md
|
207
|
-
- exec/pos-tagger.rb
|
208
|
-
- bin/pos-tagger-server
|
209
|
-
- bin/pos-tagger
|
210
|
-
- bin/pos-tagger-daemon
|
211
224
|
homepage: http://opener-project.github.com/
|
212
225
|
licenses: []
|
213
226
|
metadata: {}
|
@@ -227,9 +240,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
227
240
|
version: '0'
|
228
241
|
requirements: []
|
229
242
|
rubyforge_project:
|
230
|
-
rubygems_version: 2.
|
243
|
+
rubygems_version: 2.2.2
|
231
244
|
signing_key:
|
232
245
|
specification_version: 4
|
233
246
|
summary: Gem that wraps up the different existing pos-taggers
|
234
247
|
test_files: []
|
235
|
-
has_rdoc: yard
|
@@ -1,89 +0,0 @@
|
|
1
|
-
module Opener
|
2
|
-
class POSTagger
|
3
|
-
##
|
4
|
-
# Add Error Layer to KAF file instead of throwing an error.
|
5
|
-
#
|
6
|
-
class ErrorLayer
|
7
|
-
attr_accessor :input, :document, :error, :klass
|
8
|
-
|
9
|
-
def initialize(input, error, klass)
|
10
|
-
@input = input.to_s
|
11
|
-
# Make sure there is always a document, even if it is empty.
|
12
|
-
@document = Nokogiri::XML(input) rescue Nokogiri::XML(nil)
|
13
|
-
@error = error
|
14
|
-
@klass = klass
|
15
|
-
end
|
16
|
-
|
17
|
-
def add
|
18
|
-
if is_xml?
|
19
|
-
unless has_errors_layer?
|
20
|
-
add_errors_layer
|
21
|
-
end
|
22
|
-
else
|
23
|
-
add_root
|
24
|
-
add_text
|
25
|
-
add_errors_layer
|
26
|
-
end
|
27
|
-
add_error
|
28
|
-
|
29
|
-
xml = !!document.encoding ? document.to_xml : document.to_xml(:encoding => "UTF-8")
|
30
|
-
|
31
|
-
return xml
|
32
|
-
end
|
33
|
-
|
34
|
-
##
|
35
|
-
# Check if the document is a valid XML file.
|
36
|
-
#
|
37
|
-
def is_xml?
|
38
|
-
!!document.root
|
39
|
-
end
|
40
|
-
|
41
|
-
##
|
42
|
-
# Add root element to the XML file.
|
43
|
-
#
|
44
|
-
def add_root
|
45
|
-
root = Nokogiri::XML::Node.new "KAF", document
|
46
|
-
document.add_child(root)
|
47
|
-
end
|
48
|
-
|
49
|
-
##
|
50
|
-
# Check if the document already has an errors layer.
|
51
|
-
#
|
52
|
-
def has_errors_layer?
|
53
|
-
!!document.at('errors')
|
54
|
-
end
|
55
|
-
|
56
|
-
##
|
57
|
-
# Add errors element to the XML file.
|
58
|
-
#
|
59
|
-
def add_errors_layer
|
60
|
-
node = Nokogiri::XML::Node.new "errors", document
|
61
|
-
document.root.add_child(node)
|
62
|
-
end
|
63
|
-
|
64
|
-
##
|
65
|
-
# Add the text file incase it is not a valid XML document. More
|
66
|
-
# info for debugging.
|
67
|
-
#
|
68
|
-
def add_text
|
69
|
-
node = Nokogiri::XML::Node.new "raw", document
|
70
|
-
node.inner_html = input
|
71
|
-
document.root.add_child(node)
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
##
|
76
|
-
# Add the actual error to the errors layer.
|
77
|
-
#
|
78
|
-
def add_error
|
79
|
-
node = document.at('errors')
|
80
|
-
error_node = Nokogiri::XML::Node.new "error", node
|
81
|
-
error_node['class'] = klass.to_s
|
82
|
-
error_node['version'] = klass::VERSION
|
83
|
-
error_node.inner_html = error
|
84
|
-
node.add_child(error_node)
|
85
|
-
end
|
86
|
-
|
87
|
-
end # ErrorLayer
|
88
|
-
end # POSTagger
|
89
|
-
end # Opener
|