opener-opinion-detector-basic 3.2.5 → 3.2.6

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: 7768f85ad9e9b1641fccc5a5abc5448bce4ca4909c296ba38585395f252460ae
4
- data.tar.gz: a0fffe7f7b235421b8a64714779842d92632a2aecdc2d811a463c3c181781089
3
+ metadata.gz: 7bf885ed5d9cd309933e3419dc00f13073e42038e102bf58ed029e9ac6762101
4
+ data.tar.gz: c9b7248d4a8dd672b6d0246994e643d845ebbc73af4e8f427bde80154755a310
5
5
  SHA512:
6
- metadata.gz: '09e412db194cf4542d8a48d2b30fbb19e05f92b62f811907c40b0b11fea46a918c914e83c31b8f8459025455acec60be1937acd9509f60b0a18d34066f1ac638'
7
- data.tar.gz: 32c7cefda90fdb8662a1bbac25c4747548ff6fc75b8b84850d391046c5d880c35dfcc547789f173f3a1de9e50311eae48bbb40ee4ed389a2b8d14aa145dc6a60
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
- unless right_candidates.empty?
130
- candidate = right_candidates.first
131
- @target_ids << candidate.id
129
+ if right_candidates.any?
130
+ @target_ids << right_candidates.first.id
132
131
  end
133
-
134
- if target_ids.empty?
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
- # @return [TrueClass|FalseClass]
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
@@ -1,7 +1,7 @@
1
1
  module Opener
2
2
  class OpinionDetectorBasic
3
3
 
4
- VERSION = '3.2.5'
4
+ VERSION = '3.2.6'
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.5
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-04 00:00:00.000000000 Z
11
+ date: 2021-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opener-daemons