[12.10.20] Testing - not allowing over 80% Neutral Tweets to be passed, and removed some logging noise

This commit is contained in:
andrewso 2020-10-12 16:51:05 +01:00
parent c4b57a7e0f
commit 3a008ea088
3 changed files with 9 additions and 3 deletions

View File

@ -135,7 +135,7 @@ def processTweet(text, type):
if callSpamFilter(cleanedTweet) != 'spam':
pos, neu, neg, compound = callSentimentAnalyser(cleanedTweet)
if compound != 0.0:
if compound != 0.0 | neu <= 0.8:
hourTweet = {'pos': pos, 'neu': neu, 'neg': neg, 'compound': compound, 'type': type}
hourStack.append(hourTweet)
@ -146,10 +146,16 @@ def processTweet(text, type):
def collector(hashtag):
log("Thread Start...", 'INFO')
schedule.clear("collectTweets")
global timeF
timeF = timeFunction()
streamer = Streamer()
streamer.stream_tweets(hashtag)
schedule.every().hour.at(timeF).do(createHourJob).tag("collectTweets")
def timeFunction():
global timeF

View File

@ -10,7 +10,7 @@ class keys():
self.sentiment_analyser_uri = os.getenv("SENTIMENT_URL")
def callSentimentAnalyser(tweet):
log("Calling Sentiment Analyser for [{}]".format(tweet), 'INFO')
# log("Calling Sentiment Analyser for [{}]".format(tweet), 'INFO')
try:
uri = keys().sentiment_analyser_uri + "/sentiment?tweet="+tweet
response = requests.request("GET", uri)

View File

@ -16,7 +16,7 @@ def callSpamFilter(tweet):
response = json.loads(response.text)
log("Spam Filter result for [{}] is [{}]".format(tweet, response["result"]), 'INFO')
# log("Spam Filter result for [{}] is [{}]".format(tweet, response["result"]), 'INFO')
return response["result"]
except: