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 +4 -4
- data/core/opinion_detector_basic_multi.py +22 -15
- data/lib/opener/opinion_detector_basic/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 765314f86b29243ff3c007100653a20198d3b890
|
4
|
+
data.tar.gz: 1c8767a8dc9ccc48680d0fca3364ed7d0ef08a80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
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
|