From dee007eacf2ff0afefb7ca523219c4ce305f4dbd Mon Sep 17 00:00:00 2001 From: militarpancho Date: Thu, 11 May 2017 11:02:29 +0200 Subject: [PATCH] Fixed bug in meaningCloud plugin. Now retrieves Neutral sentiment --- sentiment-meaningCloud/sentiment-meaningCloud.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sentiment-meaningCloud/sentiment-meaningCloud.py b/sentiment-meaningCloud/sentiment-meaningCloud.py index 3cc51ad..b6253b2 100644 --- a/sentiment-meaningCloud/sentiment-meaningCloud.py +++ b/sentiment-meaningCloud/sentiment-meaningCloud.py @@ -16,9 +16,10 @@ class DaedalusPlugin(SentimentPlugin): def _polarity(self, value): - polarityValue = 0 - polarity = 'marl:Neutral' - if 'N' in value: + if 'NONE' in value: + polarity = 'marl:Neutral' + polarityValue = 0 + elif 'N' in value: polarity = 'marl:Negative' polarityValue = -1 elif 'P' in value: @@ -47,7 +48,7 @@ class DaedalusPlugin(SentimentPlugin): api_response = r.json() if not api_response.get('score_tag'): raise Error(r.json()) - + logger.info(api_response) response = Results() agg_polarity, agg_polarityValue = self._polarity(api_response.get('score_tag', None)) agg_opinion = Sentiment(id="Opinion0",