From 3b481858d9255608b28ca47150adb5c22ed6f9aa Mon Sep 17 00:00:00 2001 From: SChakravorti21 Date: Tue, 6 Feb 2018 11:32:08 -0500 Subject: [PATCH] added sentiment analysis with running compound score --- sentimentAnalysis.py | 83 --------------------------- sentiment_analysis.py | 128 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+), 83 deletions(-) delete mode 100644 sentimentAnalysis.py create mode 100644 sentiment_analysis.py diff --git a/sentimentAnalysis.py b/sentimentAnalysis.py deleted file mode 100644 index e8615e2..0000000 --- a/sentimentAnalysis.py +++ /dev/null @@ -1,83 +0,0 @@ -from tweepy import Stream, OAuthHandler, StreamListener -import json -from datetime import * -import numpy as np - -timestamp=datetime.strftime(datetime.now(),"%Y%m%d%H%M%S") - -class listener(StreamListener): - def on_data(self,data): - try: - tweet= json.loads(data) - #print len(tweet),tweet['user']['screen_name'],tweet['text'] - #print tweet['user']['location'],tweet['user']['geo_enabled'],tweet['coordinates'],tweet['geo'],tweet['place'] - - if "in_reply_to_screen_name" not in tweet or tweet["in_reply_to_screen_name"] == None or tweet["in_reply_to_screen_name"] == 'null': - - if len(tweets['no_reply'])