[12.10.20] Testing - not allowing over 80% Neutral Tweets to be passed, and removed some logging noise
This commit is contained in:
parent
c4b57a7e0f
commit
3a008ea088
@ -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
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user