Create a python code that does the following below from the txt file called tweets.txt: Count the 10 words that appear most frequently in these tweets and print them in reverse order of frequency Report what hashtags are used the tweets, including the number of times all hashtags appear in these tweets. (hint: you can use a regular expression to identify hashtags OR look for words which start with a #) Identifies how many of the tweets are retweets (retweets on twitter start with “RT @“) (hint: you can use a regular expression for this. What is the regular expression that matches the beginning of a string?) Identifies the 10 accounts which were retweeted the most Identify how many of these tweets are talking about the vaccine (you can use the keyword “vaccine” to look for tweets talking about the vaccine) Identifies the average sentiment among these tweets
Create a python code that does the following below from the txt file called tweets.txt:
- Count the 10 words that appear most frequently in these tweets and print them in reverse order of frequency
- Report what hashtags are used the tweets, including the number of times all hashtags appear in these tweets. (hint: you can use a regular expression to identify hashtags OR look for words which start with a #)
- Identifies how many of the tweets are retweets (retweets on twitter start with “RT @“) (hint: you can use a regular expression for this. What is the regular expression that matches the beginning of a string?)
- Identifies the 10 accounts which were retweeted the most
- Identify how many of these tweets are talking about the vaccine (you can use the keyword “vaccine” to look for tweets talking about the vaccine)
- Identifies the average sentiment among these tweets
Example of the output:
************************
Most frequent words
************************
covid, 204
Fauci, 134
the, 122
…
************************
Hashtags used
************************
#covid, 221
#vaccine, 144
#cscw, 102
…
************************
Retweets
************************
1,359 out of the 5,000 tweets are retweets
************************
Most Retweeted accounts
************************
bryan_kirschner, 304
gvrkiasa, 292
ingmase, 143
…
************************
Vaccine tweets
************************
439 out of the 5,000 tweets talk about the vaccine
************************
Sentiment
************************
The average sentiment of the 5,000 tweets is 0.421
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
You didn't have the count displayed next to part 1, part 2, or part 3 and you skipped part 4