opener-opinion-detector-basic 3.2.8 → 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: 25eca945fb8a710dedd525a176d6bc67dc447e8df35641040e36d15a62174426
4
- data.tar.gz: ba69559d1744561cd062293e753d189f396c046a7a9421ca76ee404e88c7e51b
3
+ metadata.gz: 6c015888b4578913991c2589ebb6fc24d34980cb4e5dc4a57412bf5775fcb5db
4
+ data.tar.gz: 4250a3371836791463512e06bda9bbcdc0010015c5edde93c70b4cbf64507726
5
5
  SHA512:
6
- metadata.gz: 63ad07f3acd8c86374dfcc50c6b30b5ac2dc9457404ad4f4e22cdf2f5e2e742cb52b3d7303f109c89bb32c212ee07028a68ed2cb3e8b42609ba6ebcd795878ab
7
- data.tar.gz: 11e843fb887c1fcfa3e33e68e1e05330a3bac7a5a4bc27261e8c7fec93b76bba20a470e4b2e634197b60b1731d47ea341f9f5312916cb12f82031a9ec17239cf
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(sentence_terms[min..max])
112
+ @right_candidates = filter_candidates sentence_terms[min..max]
113
113
  end
114
114
 
115
115
  index = 0
@@ -123,7 +123,7 @@ 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(sentence_terms[min..max])
126
+ @left_candidates = filter_candidates sentence_terms[min..max].reverse
127
127
  end
128
128
 
129
129
  if right_candidates.any?
@@ -143,7 +143,8 @@ module Opener
143
143
  # @return [Hash]
144
144
  #
145
145
  def filter_candidates sentence_terms
146
- sentence_terms.select{|t| (t.pos == 'N' || t.pos == 'R') && !ids.include?(t.id)}
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]
@@ -1,7 +1,7 @@
1
1
  module Opener
2
2
  class OpinionDetectorBasic
3
3
 
4
- VERSION = '3.2.8'
4
+ VERSION = '3.3.0'
5
5
 
6
6
  end
7
7
  end
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.8
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: 2021-08-29 00:00:00.000000000 Z
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.2.14
202
+ rubygems_version: 3.1.6
203
203
  signing_key:
204
204
  specification_version: 4
205
205
  summary: Basic Opinion Detector.