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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Create a python code that does the following below from the txt file called tweets.txt:

  1. Count the 10 words that appear most frequently in these tweets and print them in reverse order of frequency
  2. 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 #)
  3. 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?)
  4. Identifies the 10 accounts which were retweeted the most
  5. 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)
  6. 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

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

You didn't have the count displayed next to part 1, part 2, or part 3 and you skipped part 4

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education