opener-tree-tagger 3.2.4 → 3.2.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f40d6a7240dc070760cff4cc37db4bc379446dc4
|
4
|
+
data.tar.gz: fae0e536b213f291847f8ce12f4e47f188aa5247
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c37d73ad22dce5020e8f78ab839d929585b3637f4b7a7487b315c0f5895bc03772c8a5b0c08c97004c7eb6675bf5fb03879b50f25a08401fba877d5f7e2ae181
|
7
|
+
data.tar.gz: bd345fe22dfd8fd2412f00c2ce740ce9bcb27a6d95b72fd1866edffcee9d8a43803b549d1dbad3289ef15479285326e8acdc9d819a10ffc2e55ac5e3042dd704
|
Binary file
|
data/lib/opener/tree_tagger.rb
CHANGED
@@ -4,7 +4,6 @@ require 'nokogiri'
|
|
4
4
|
|
5
5
|
require_relative 'tree_tagger/version'
|
6
6
|
require_relative 'tree_tagger/cli'
|
7
|
-
require_relative 'tree_tagger/error_layer'
|
8
7
|
|
9
8
|
module Opener
|
10
9
|
class TreeTagger
|
@@ -36,7 +35,7 @@ module Opener
|
|
36
35
|
raise stderr unless process.success?
|
37
36
|
return stdout
|
38
37
|
rescue Exception => error
|
39
|
-
return ErrorLayer.new(input, error.message, self.class).add
|
38
|
+
return Opener::Core::ErrorLayer.new(input, error.message, self.class).add
|
40
39
|
end
|
41
40
|
end
|
42
41
|
|
data/opener-tree-tagger.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opener-tree-tagger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rubenIzquierdo
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-06-
|
12
|
+
date: 2014-06-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: opener-daemons
|
@@ -95,6 +95,20 @@ dependencies:
|
|
95
95
|
version: '0'
|
96
96
|
prerelease: false
|
97
97
|
type: :runtime
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: opener-core
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ~>
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 1.0.2
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.0.2
|
110
|
+
prerelease: false
|
111
|
+
type: :runtime
|
98
112
|
- !ruby/object:Gem::Dependency
|
99
113
|
name: nokogiri
|
100
114
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -175,12 +189,12 @@ files:
|
|
175
189
|
- core/italian.map.treetagger.kaf.csv
|
176
190
|
- core/spanish.map.treetagger.kaf.csv
|
177
191
|
- core/token_matcher.py
|
192
|
+
- core/token_matcher.pyo
|
178
193
|
- core/tt_from_kaf_to_kaf.py
|
179
194
|
- exec/tree-tagger.rb
|
180
195
|
- ext/hack/Rakefile
|
181
196
|
- lib/opener/tree_tagger.rb
|
182
197
|
- lib/opener/tree_tagger/cli.rb
|
183
|
-
- lib/opener/tree_tagger/error_layer.rb
|
184
198
|
- lib/opener/tree_tagger/public/markdown.css
|
185
199
|
- lib/opener/tree_tagger/server.rb
|
186
200
|
- lib/opener/tree_tagger/version.rb
|
@@ -1,89 +0,0 @@
|
|
1
|
-
module Opener
|
2
|
-
class TreeTagger
|
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 # TreeTagger
|
89
|
-
end # Opener
|