opener-property-tagger 3.3.3 → 3.3.4
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 436af27476deb0372f325ed255151bf5128608405c740289931ecb630b111ab4
|
4
|
+
data.tar.gz: 5ff2d6bf101e606a786f0b4a9da8021a231ea07fac29fb51c452a1aefa737954
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4918a0be797e2776329863a1f9f43609b9b30390e6165e73c4e089f533ce769a077e82fa928091285dbf866039dad589b7a650b7c6ffd9cc403c355862a9bd5b
|
7
|
+
data.tar.gz: bcac64dc7d1f229b264976070c05f64e5ff42c54ba2f809f905beb4d7597acea6c71923c271c4bc5dd77c979aa78ffdcb74757c5d27f6819bb6e62186d41fed8
|
@@ -25,7 +25,7 @@ module Opener
|
|
25
25
|
# by default due to the performance overhead.
|
26
26
|
#
|
27
27
|
def initialize file, params: {}, url: nil, path: nil, timestamp: true, pretty: false
|
28
|
-
@document =
|
28
|
+
@document = Nokogiri.XML file
|
29
29
|
raise 'Error parsing input. Input is required to be KAF' unless is_kaf?
|
30
30
|
@timestamp = timestamp
|
31
31
|
@pretty = pretty
|
@@ -60,25 +60,16 @@ module Opener
|
|
60
60
|
return pretty ? pretty_print(document) : document.to_xml
|
61
61
|
end
|
62
62
|
|
63
|
-
##
|
64
|
-
# Get the language of the input file.
|
65
|
-
#
|
66
|
-
# @return [String]
|
67
|
-
#
|
68
63
|
def language
|
69
|
-
return @language ||= document.at_xpath('KAF').
|
64
|
+
return @language ||= document.at_xpath('KAF').attr('xml:lang')
|
70
65
|
end
|
71
66
|
|
72
|
-
##
|
73
|
-
# Get the terms from the input file
|
74
|
-
# @return [Hash]
|
75
|
-
#
|
76
67
|
def terms
|
77
68
|
unless @terms
|
78
69
|
@terms = {}
|
79
70
|
|
80
71
|
document.xpath('KAF/terms/term').each do |term|
|
81
|
-
@terms[term.
|
72
|
+
@terms[term.attr('tid').to_sym] = term.attr('lemma')
|
82
73
|
end
|
83
74
|
end
|
84
75
|
|
@@ -143,22 +134,21 @@ module Opener
|
|
143
134
|
def add_property(key, value, index)
|
144
135
|
property_node = new_node("property", "KAF/features/properties")
|
145
136
|
|
146
|
-
property_node
|
147
|
-
property_node
|
137
|
+
property_node['lemma'] = key.to_s
|
138
|
+
property_node['pid'] = "p#{index.to_s}"
|
148
139
|
|
149
140
|
references_node = new_node("references", property_node)
|
150
141
|
|
151
142
|
value.uniq.each do |v|
|
152
|
-
|
153
|
-
|
154
|
-
references_node.children << comment
|
143
|
+
comm_node = Nokogiri::XML::Comment.new(references_node, " #{v.last} ")
|
144
|
+
references_node.add_child comm_node
|
155
145
|
|
156
146
|
span_node = new_node("span", references_node)
|
157
147
|
|
158
148
|
v.first.each do |val|
|
159
|
-
target_node
|
149
|
+
target_node = new_node("target", span_node)
|
160
150
|
|
161
|
-
target_node
|
151
|
+
target_node['id'] = val.to_s
|
162
152
|
end
|
163
153
|
end
|
164
154
|
end
|
@@ -169,19 +159,19 @@ module Opener
|
|
169
159
|
version = '2.0'
|
170
160
|
|
171
161
|
node = new_node('linguisticProcessors', 'KAF/kafHeader')
|
172
|
-
node
|
162
|
+
node['layer'] = 'features'
|
173
163
|
|
174
164
|
lp_node = new_node('lp', node)
|
175
165
|
|
176
|
-
lp_node
|
177
|
-
lp_node
|
166
|
+
lp_node['version'] = "#{last_edited}-#{version}"
|
167
|
+
lp_node['name'] = description
|
178
168
|
|
179
169
|
if timestamp
|
180
170
|
format = '%Y-%m-%dT%H:%M:%S%Z'
|
181
171
|
|
182
|
-
lp_node
|
172
|
+
lp_node['timestamp'] = Time.now.strftime(format)
|
183
173
|
else
|
184
|
-
lp_node
|
174
|
+
lp_node['timestamp'] = '*'
|
185
175
|
end
|
186
176
|
end
|
187
177
|
|
@@ -212,9 +202,9 @@ module Opener
|
|
212
202
|
parent_node = parent
|
213
203
|
end
|
214
204
|
|
215
|
-
node =
|
205
|
+
node = Nokogiri::XML::Element.new(tag, document)
|
216
206
|
|
217
|
-
parent_node.
|
207
|
+
parent_node.add_child node
|
218
208
|
|
219
209
|
return node
|
220
210
|
end
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |gem|
|
|
28
28
|
gem.add_dependency 'opener-webservice', '~> 2.1'
|
29
29
|
gem.add_dependency 'opener-core', '~> 2.2'
|
30
30
|
|
31
|
-
gem.add_dependency '
|
31
|
+
gem.add_dependency 'nokogiri'
|
32
32
|
gem.add_dependency 'httpclient'
|
33
33
|
gem.add_dependency 'hashie'
|
34
34
|
gem.add_dependency 'activesupport'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opener-property-tagger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.4
|
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: 2020-11-
|
11
|
+
date: 2020-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opener-daemons
|
@@ -53,25 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: nokogiri
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.0'
|
62
59
|
- - ">="
|
63
60
|
- !ruby/object:Gem::Version
|
64
|
-
version:
|
61
|
+
version: '0'
|
65
62
|
type: :runtime
|
66
63
|
prerelease: false
|
67
64
|
version_requirements: !ruby/object:Gem::Requirement
|
68
65
|
requirements:
|
69
|
-
- - "~>"
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: '1.0'
|
72
66
|
- - ">="
|
73
67
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
68
|
+
version: '0'
|
75
69
|
- !ruby/object:Gem::Dependency
|
76
70
|
name: httpclient
|
77
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,9 +167,9 @@ dependencies:
|
|
173
167
|
description: Property tagger for hotels in Dutch and English.
|
174
168
|
email:
|
175
169
|
executables:
|
176
|
-
- property-tagger-server
|
177
170
|
- property-tagger
|
178
171
|
- property-tagger-daemon
|
172
|
+
- property-tagger-server
|
179
173
|
extensions: []
|
180
174
|
extra_rdoc_files: []
|
181
175
|
files:
|