I am trying to do a sentiment analysis with twitter data. I know that the tokens in my POStagged_tweets_lines.json file are 90% neutral. My loop:
with open('POStagged_tweets_lines.json', 'r') as f:
for line in f:
blob = TextBlob(line, classifier=classifier)
#blob = TextBlob('POStagged_tweets.json',
classification = blob.classify()
#print(classification)
pos = "pos"
neg = "neg"
neu = "neu"
negative = 0
positive = 0
neutral = 0
if classification == neu:
neutral += 1
elif classification == pos:
positive += 1
elif classification == neg:
negative += 1
print(negative, positive, neutral)
Should be counting the sentiments of the tweets in the json file. So, at the end I should be getting an output such as 5, 12, 100
; but Instead I am getting 0 0 1
and I don't even know where is it coming from.