opener-opinion-detector-basic 3.2.7 → 3.3.0
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: 6c015888b4578913991c2589ebb6fc24d34980cb4e5dc4a57412bf5775fcb5db
|
4
|
+
data.tar.gz: 4250a3371836791463512e06bda9bbcdc0010015c5edde93c70b4cbf64507726
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c9084991ede605db1fe11ef0e9a2de6b853bb9dc9fe499ac0074f39b4eaf9396af55c58d65fa3f12453d4f71253652a82ae9feab1304b9732ffd1ad58569d8d
|
7
|
+
data.tar.gz: a53259fd1364af42392d120065b95d0658c2b153878e4a7847a8332c626b9421b9fb45728ebf43d9b71fa976416c8eb065cdc1a90473d9ea609e99bb84aca243
|
@@ -109,7 +109,7 @@ module Opener
|
|
109
109
|
unless index+1 >= terms_count
|
110
110
|
min = index+1
|
111
111
|
max = [index+1+max_distance,terms_count].min
|
112
|
-
@right_candidates = filter_candidates
|
112
|
+
@right_candidates = filter_candidates sentence_terms[min..max]
|
113
113
|
end
|
114
114
|
|
115
115
|
index = 0
|
@@ -123,14 +123,14 @@ module Opener
|
|
123
123
|
unless index == 0
|
124
124
|
min = [0, index-1-max_distance].max
|
125
125
|
max = index
|
126
|
-
@left_candidates = filter_candidates
|
126
|
+
@left_candidates = filter_candidates sentence_terms[min..max].reverse
|
127
127
|
end
|
128
128
|
|
129
129
|
if right_candidates.any?
|
130
130
|
@target_ids << right_candidates.first.id
|
131
131
|
end
|
132
132
|
if left_candidates.any?
|
133
|
-
@target_ids << left_candidates.
|
133
|
+
@target_ids << left_candidates.last.id
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
@@ -143,7 +143,8 @@ module Opener
|
|
143
143
|
# @return [Hash]
|
144
144
|
#
|
145
145
|
def filter_candidates sentence_terms
|
146
|
-
sentence_terms.
|
146
|
+
filtered = sentence_terms.take_while{ |t| !t.is_punct? } # stop on punctuation
|
147
|
+
filtered.select{ |t| (t.pos == 'N' || t.pos == 'R') && !ids.include?(t.id) }
|
147
148
|
end
|
148
149
|
|
149
150
|
end
|
@@ -173,6 +173,10 @@ module Opener
|
|
173
173
|
pos == 'J' || xpos == ',' || lemma == ',' || CONJUNCTIONS[language]&.include?(lemma)
|
174
174
|
end
|
175
175
|
|
176
|
+
def is_punct?
|
177
|
+
pos == '.' || lemma == '-' || xpos == ',' || lemma == ','
|
178
|
+
end
|
179
|
+
|
176
180
|
private
|
177
181
|
|
178
182
|
# @return [Oga::XML::Element]
|
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.
|
4
|
+
version: 3.3.0
|
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:
|
11
|
+
date: 2024-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opener-daemons
|
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
199
|
- !ruby/object:Gem::Version
|
200
200
|
version: '0'
|
201
201
|
requirements: []
|
202
|
-
rubygems_version: 3.
|
202
|
+
rubygems_version: 3.1.6
|
203
203
|
signing_key:
|
204
204
|
specification_version: 4
|
205
205
|
summary: Basic Opinion Detector.
|