opener-opinion-detector-basic 3.2.5 → 3.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bf885ed5d9cd309933e3419dc00f13073e42038e102bf58ed029e9ac6762101
|
4
|
+
data.tar.gz: c9b7248d4a8dd672b6d0246994e643d845ebbc73af4e8f427bde80154755a310
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2caf7e13cb13f4574446e4deaa246212b7a54630f94ba883803a360fb81a4e43c2d77b8dd140eaa5582d25efe1793d67145385f49acec275e1399cd52c3d1785
|
7
|
+
data.tar.gz: 16346fb5631e18212bcc690353f384da813f4baa6f48e7f32263183e2f86dee39293876954dedaddd05baa3aa32d970e361e2a8ef6f7f8de7feff96991c90b2b
|
@@ -126,43 +126,16 @@ module Opener
|
|
126
126
|
@left_candidates = filter_candidates(sentence_terms[min..max])
|
127
127
|
end
|
128
128
|
|
129
|
-
|
130
|
-
|
131
|
-
@target_ids << candidate.id
|
129
|
+
if right_candidates.any?
|
130
|
+
@target_ids << right_candidates.first.id
|
132
131
|
end
|
133
|
-
|
134
|
-
|
135
|
-
list = mix_lists(right_candidates, left_candidates)
|
136
|
-
list.each do |l|
|
137
|
-
@target_ids << l.id
|
138
|
-
break
|
139
|
-
end
|
132
|
+
if left_candidates.any?
|
133
|
+
@target_ids << left_candidates.first.id
|
140
134
|
end
|
141
135
|
end
|
142
136
|
|
143
137
|
protected
|
144
138
|
|
145
|
-
##
|
146
|
-
# If there are no opinion targets, right and left candidates
|
147
|
-
# are mixed into one list and the first one is picked as the target.
|
148
|
-
#
|
149
|
-
# @return [Array]
|
150
|
-
#
|
151
|
-
def mix_lists(lista, listb)
|
152
|
-
list = []
|
153
|
-
min = [lista.count, listb.count].min
|
154
|
-
(0..min).each do |i|
|
155
|
-
list << lista[i]
|
156
|
-
list << listb[i]
|
157
|
-
if lista.count > listb.count
|
158
|
-
list << lista[min]
|
159
|
-
elsif listb.count > lista.count
|
160
|
-
list << listb[min]
|
161
|
-
end
|
162
|
-
end
|
163
|
-
return list.compact
|
164
|
-
end
|
165
|
-
|
166
139
|
##
|
167
140
|
# Filters candidate terms depending on their part of speech and if
|
168
141
|
# they are already part of the expression.
|
@@ -16,7 +16,7 @@ module Opener
|
|
16
16
|
'es' => %w{, y e},
|
17
17
|
'it' => %w{, e ed},
|
18
18
|
'de' => %w{, und},
|
19
|
-
'fr' => %w{, et}
|
19
|
+
'fr' => %w{, et},
|
20
20
|
}
|
21
21
|
|
22
22
|
def initialize node, document, language
|
@@ -74,6 +74,10 @@ module Opener
|
|
74
74
|
@pos ||= node.attr('pos')
|
75
75
|
end
|
76
76
|
|
77
|
+
def xpos
|
78
|
+
@xpos ||= node.attr('xpos')
|
79
|
+
end
|
80
|
+
|
77
81
|
def lexicon_id
|
78
82
|
@lexicon_id ||= node.attr('lexicon-id')
|
79
83
|
end
|
@@ -161,11 +165,11 @@ module Opener
|
|
161
165
|
|
162
166
|
##
|
163
167
|
# Checks if a term is a conjunction.
|
164
|
-
#
|
165
|
-
#
|
168
|
+
# Comma is identified as conjunction by default
|
169
|
+
# Sometimes, comma comes with space after it
|
166
170
|
#
|
167
171
|
def is_conjunction?(language)
|
168
|
-
pos == 'J' || CONJUNCTIONS[language]&.include?(lemma)
|
172
|
+
pos == 'J' || xpos == ',' || CONJUNCTIONS[language]&.include?(lemma)
|
169
173
|
end
|
170
174
|
|
171
175
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opener-opinion-detector-basic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.6
|
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: 2021-08-
|
11
|
+
date: 2021-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opener-daemons
|