opener-opinion-detector-basic 2.0.6 → 2.0.7

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
  SHA1:
3
- metadata.gz: 623f2b6acc84b09adb6ca6bcf33d3f3d21454ff2
4
- data.tar.gz: 0a6b9f331ed8daa3e4d3d4dbce06b44bd6ece5fb
3
+ metadata.gz: 765314f86b29243ff3c007100653a20198d3b890
4
+ data.tar.gz: 1c8767a8dc9ccc48680d0fca3364ed7d0ef08a80
5
5
  SHA512:
6
- metadata.gz: 54d2e768d2a8db9a9ee4e610808496181f499347cccb962a29af5047b97e5ac603b28931e723299ae88b6993604b8596bd3b4e2f1b660bd2f5751422f555bbdf
7
- data.tar.gz: 50cd0843da192aac3d20bcfbc60b9855d5d9b2cde92bae131a6fcb091f69c4f4d8603b40de10d0bd6fb20d2af0cabab451e98f9d46d7d773e456f149ad8470fb
6
+ metadata.gz: 9972bff4b61846eac50d946c1350ba65fef31fd15e6876a58b7c85c627efb11fd4427543a25ccb20310e94a3a3ab965a57199a4344f07227434688a75aa610ce
7
+ data.tar.gz: b454c68ab7ed948db7e39e879646f8e07c64f65c90b2ec1713a0a9aeb8736cb516ba28ed2175f30ea52cfb7f7342585849340b5a756ae934715bc921545cf648
@@ -108,21 +108,27 @@ def obtain_opinion_expressions(tokens,lang='nl'):
108
108
  logging.debug(' Accumulating modifiers')
109
109
  t = 0
110
110
  while t < len(my_tokens):
111
- if my_tokens[t].isNegator() or my_tokens[t].isIntensifier():
112
- if t+1 < len(my_tokens) and ( my_tokens[t+1].isNegator() or my_tokens[t+1].isIntensifier()):
113
- if my_tokens[t+1].isNegator():
114
- my_tokens[t+1].value *= my_tokens[t].value
115
- logging.debug(' Accumulating '+'-'.join(my_tokens[t+1].list_ids))
116
- if my_tokens[t+1].isIntensifier():
117
- my_tokens[t+1].value += my_tokens[t].value
118
-
119
- ## There are 2 negators/intensifiers next to each other
120
- ## The first one is deactivated and the second one is modified
121
- my_tokens[t].use_it = False
122
- my_tokens[t+1].list_ids += my_tokens[t].list_ids
123
- logging.debug(' Accumulating '+'-'.join(my_tokens[t+1].list_ids))
124
-
125
- t+=1
111
+ if t+1 < len(my_tokens):
112
+ if (my_tokens[t].isNegator() or my_tokens[t].isIntensifier()) and my_tokens[t+1].isNegator():
113
+ my_tokens[t+1].value *= my_tokens[t].value
114
+ my_tokens[t].use_it = False
115
+ my_tokens[t+1].list_ids += my_tokens[t].list_ids
116
+ logging.debug(' Accumulating '+'-'.join(my_tokens[t+1].list_ids))
117
+ elif my_tokens[t].isNegator() and my_tokens[t+1].isIntensifier():
118
+ my_tokens[t+1].value *= -1
119
+ my_tokens[t].use_it = False
120
+ my_tokens[t+1].list_ids += my_tokens[t].list_ids
121
+ logging.debug(' Accumulating '+'-'.join(my_tokens[t+1].list_ids))
122
+ elif my_tokens[t].isIntensifier() and my_tokens[t+1].isIntensifier():
123
+ if my_tokens[t].value >= 0:
124
+ my_tokens[t+1].value = my_tokens[t].value + my_tokens[t+1].value
125
+ else:
126
+ my_tokens[t+1].value = my_tokens[t].value - my_tokens[t+1].value
127
+ my_tokens[t].use_it = False
128
+ my_tokens[t+1].list_ids += my_tokens[t].list_ids
129
+ logging.debug(' Accumulating '+'-'.join(my_tokens[t+1].list_ids))
130
+
131
+ t+=1
126
132
  ###########################################
127
133
 
128
134
  ##Apply intensifiers/negators over the next elements
@@ -133,6 +139,7 @@ def obtain_opinion_expressions(tokens,lang='nl'):
133
139
  if my_tokens[t].use_it and (my_tokens[t].isNegator() or my_tokens[t].isIntensifier()):
134
140
  ## Try to modify the next token:
135
141
  if t+1<len(my_tokens):
142
+ #print 'Score: ',my_tokens[t]
136
143
  my_tokens[t+1].value *= my_tokens[t].value
137
144
  my_tokens[t+1].list_ids += my_tokens[t].list_ids
138
145
  my_tokens[t].use_it = False
@@ -1,5 +1,5 @@
1
1
  module Opener
2
2
  class OpinionDetectorBasic
3
- VERSION = '2.0.6'
3
+ VERSION = '2.0.7'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opener-opinion-detector-basic
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - development@olery.com