opener-opinion-detector-basic 3.2.4 → 3.2.8

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: fa1aba5cb9ba31f6e2205af1499f866f9e998883701b303f2229ecc855348293
4
- data.tar.gz: db3a5d5021a0013757ba68252ccaed4c185a0960aaa9ca26e47681e0b3300d11
3
+ metadata.gz: 25eca945fb8a710dedd525a176d6bc67dc447e8df35641040e36d15a62174426
4
+ data.tar.gz: ba69559d1744561cd062293e753d189f396c046a7a9421ca76ee404e88c7e51b
5
5
  SHA512:
6
- metadata.gz: 5e6e4ae440580e6ed2974c4a75b46f544212c8557ae3fe43fcbb4e4c3a7d7a6d71a058451f3abdae352766914182dc40237f42df54a565c7c866054828c758c8
7
- data.tar.gz: 3db868535c5f43814b4b883ecd9d5b0bd02fb59de5ed290c6c1b3face4d65993d84c2971a2c7dc021b607b6c228735dd82f8931c909911302577dd3bcb4558f5
6
+ metadata.gz: 63ad07f3acd8c86374dfcc50c6b30b5ac2dc9457404ad4f4e22cdf2f5e2e742cb52b3d7303f109c89bb32c212ee07028a68ed2cb3e8b42609ba6ebcd795878ab
7
+ data.tar.gz: 11e843fb887c1fcfa3e33e68e1e05330a3bac7a5a4bc27261e8c7fec93b76bba20a470e4b2e634197b60b1731d47ea341f9f5312916cb12f82031a9ec17239cf
@@ -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.last.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.
@@ -14,9 +14,10 @@ module Opener
14
14
  'nl' => %w{, en},
15
15
  'en' => %w{, and},
16
16
  'es' => %w{, y e},
17
+ 'pt' => %w{, e},
17
18
  'it' => %w{, e ed},
18
19
  'de' => %w{, und},
19
- 'fr' => %w{, et}
20
+ 'fr' => %w{, et},
20
21
  }
21
22
 
22
23
  def initialize node, document, language
@@ -74,6 +75,10 @@ module Opener
74
75
  @pos ||= node.attr('pos')
75
76
  end
76
77
 
78
+ def xpos
79
+ @xpos ||= node.attr('xpos')
80
+ end
81
+
77
82
  def lexicon_id
78
83
  @lexicon_id ||= node.attr('lexicon-id')
79
84
  end
@@ -161,11 +166,11 @@ module Opener
161
166
 
162
167
  ##
163
168
  # Checks if a term is a conjunction.
164
- #
165
- # @return [TrueClass|FalseClass]
169
+ # Comma is identified as conjunction by default
170
+ # Sometimes, comma comes with space after it
166
171
  #
167
172
  def is_conjunction?(language)
168
- pos == 'J' || CONJUNCTIONS[language]&.include?(lemma)
173
+ pos == 'J' || xpos == ',' || lemma == ',' || CONJUNCTIONS[language]&.include?(lemma)
169
174
  end
170
175
 
171
176
  private
@@ -1,7 +1,7 @@
1
1
  module Opener
2
2
  class OpinionDetectorBasic
3
3
 
4
- VERSION = '3.2.4'
4
+ VERSION = '3.2.8'
5
5
 
6
6
  end
7
7
  end
@@ -41,6 +41,7 @@ module Opener
41
41
  def initialize(options = {})
42
42
  @args = options.delete(:args) || []
43
43
  @options = options
44
+ ENV['OPINION_LEGACY'] = 'true' # Processor is still not working
44
45
  @klass = if ENV['OPINION_LEGACY'] then LegacyProcessor else Processor end
45
46
  end
46
47
 
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
4
+ version: 3.2.8
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-03 00:00:00.000000000 Z
11
+ date: 2021-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opener-daemons