April 25th

image from rotten tomatoes
#gather tweets from the movie Miss Congeniality
c = twint.Config()
c.Search = "Miss Congeniality"
c.Limit = 20000
c.Since = "2000-12-14" #released December 14, 2000
c.Until = "2021-04-26"
c.Pandas = True
# twint.run.Search(c)MC = twint.storage.panda.Tweets_df
MC.head()
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
vader = SentimentIntensityAnalyzer()
MC['positive sentiment score'] = MC['tweet'].apply(lambda x: vader.polarity_scores(x)['pos'])
MC['negative sentiment score'] = MC['tweet'].apply(lambda x: vader.polarity_scores(x)['neg'])
MC['neutral sentiment score'] = MC['tweet'].apply(lambda x: vader.polarity_scores(x)['neu'])
MC['compound sentiment score'] = MC['tweet'].apply(lambda x: vader.polarity_scores(x)['compound'])
#distribution of vader score
fig, ax = plt.subplots(figsize=(15,7))
ax = sns.distplot(MissCongeniality['compound sentiment score'], color = 'firebrick')
plt.xlabel('Sentiment Score', fontsize=18)
plt.ylabel('Tweets per Score', fontsize=18)
plt.title('VADER Sentiment of Miss Congeniality', fontsize=22)
plt.tick_params(labelsize='large')
#determining a neutral sentiment value, negative sentiment value, and positive sentiment value
sentiment = {'negative':0, 'neutral':0, 'positive':0}
for x in MissCongeniality['compound sentiment score']:
if x < -.1:
sentiment['negative'] += 1
elif -0.1 <= x <= 0.1: #space for the score to be neutral beyond a perfect 0
sentiment['neutral'] += 1
else:
sentiment['positive'] += 1
print('Miss Congeniality sentiment count:', sentiment)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store