From 657f88cb6e65731ca1d39067094cbe0f5d18e2fc Mon Sep 17 00:00:00 2001 From: Alex Ellis Date: Wed, 3 May 2017 21:26:58 +0100 Subject: [PATCH] Correct identation error in sample. --- sample-functions/SentimentAnalysis/handler.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sample-functions/SentimentAnalysis/handler.py b/sample-functions/SentimentAnalysis/handler.py index e995dcc5..0bb88fc1 100644 --- a/sample-functions/SentimentAnalysis/handler.py +++ b/sample-functions/SentimentAnalysis/handler.py @@ -2,7 +2,7 @@ import sys import json from textblob import TextBlob -# set default encoding to UTF-8 to eliminate decoding errors +# Set encoding to UTF-8 (vs ASCII to eliminate potential errors). reload(sys) sys.setdefaultencoding('utf8') @@ -10,7 +10,7 @@ def get_stdin(): buf = "" for line in sys.stdin: buf = buf + line - return buf + return buf if(__name__ == "__main__"): st = get_stdin() @@ -29,4 +29,5 @@ if(__name__ == "__main__"): res["sentence_count"] = total res["polarity"] = res["polarity"] / total res["subjectivity"] = res["subjectivity"] / total + print(json.dumps(res))