1
0
mirror of https://github.com/gsi-upm/senpy synced 2024-09-28 17:01:43 +00:00

Fixed bug in meaningCloud plugin. Now retrieves Neutral sentiment

This commit is contained in:
militarpancho 2017-05-11 11:02:29 +02:00
parent 1ef9dac86a
commit dee007eacf

View File

@ -16,9 +16,10 @@ class DaedalusPlugin(SentimentPlugin):
def _polarity(self, value): def _polarity(self, value):
polarityValue = 0 if 'NONE' in value:
polarity = 'marl:Neutral' polarity = 'marl:Neutral'
if 'N' in value: polarityValue = 0
elif 'N' in value:
polarity = 'marl:Negative' polarity = 'marl:Negative'
polarityValue = -1 polarityValue = -1
elif 'P' in value: elif 'P' in value:
@ -47,7 +48,7 @@ class DaedalusPlugin(SentimentPlugin):
api_response = r.json() api_response = r.json()
if not api_response.get('score_tag'): if not api_response.get('score_tag'):
raise Error(r.json()) raise Error(r.json())
logger.info(api_response)
response = Results() response = Results()
agg_polarity, agg_polarityValue = self._polarity(api_response.get('score_tag', None)) agg_polarity, agg_polarityValue = self._polarity(api_response.get('score_tag', None))
agg_opinion = Sentiment(id="Opinion0", agg_opinion = Sentiment(id="Opinion0",