Ah, I see. Because I didn’t add the sentiment count for the if handle =!'#'
So I added it.
if handle[0]!='#':
list_of_tweets = tweet_text.get_hashtag(handle)
list_of_tweets_and_sentiments = []
for i in list_of_tweets:
list_of_tweets_and_sentiments.append((i,analyse.get_tweet_sentiment(i)))
for i,j in list_of_tweets_and_sentiments:
if j =="Negative":
neg = neg + 1
elif j == "Positive":
pos = pos+1
else :
neu = neu +1
args = {'list_of_tweets_and_sentiments':list_of_tweets_and_sentiments, 'handle':handle, 'neg':neg,'pos':pos,"neu":neu}
return render(request, 'home/sentiment_import_result_hashtag.html', args)
if handle[0]=='#':
list_of_tweets = tweet_text.get_hashtag(handle)
list_of_tweets_and_sentiments = []
for i in list_of_tweets:
list_of_tweets_and_sentiments.append((i,analyse.get_tweet_sentiment(i)))
for i,j in list_of_tweets_and_sentiments:
if j =="Negative":
neg = neg + 1
elif j == "Positive":
pos = pos+1
else :
neu = neu +1
args = {'list_of_tweets_and_sentiments':list_of_tweets_and_sentiments, 'handle':handle,'neg':neg,'pos':pos,"neu":neu}
return render(request, 'home/sentiment_import_result_hashtag.html', args)
but now I get this error in the web page:
I think the error is in this one: neu = neu +1