Inside Files (Use Python) Write a program that accepts an integer input, opens a file, and analyzes what and how many types of words are there in a line within the opened file. PROGRAM DESIGN The program should be able to accept an integer input. This program should be able to open and read a file called tweets2.txt. The integer input represents the order of the line (from 1st to 5th line), within the tweets2.txt file. The program should be able to count how many stopwords, common words, unique words, and overall words are there in the line number input. In Natural Language Processing (NLP), stopwords are defined to be words with no meaning when left alone and with no context. For this activity, stopwords are words that are at most, 3 characters in length, with common words having more than 3 characters. Unique words are words, within the line, that don’t have any duplicates. Whereas overall words are the over all count of all words within the line. The program should also be able to filter out (remove) symbols from further processing. Required file: tweets2.txt file (See the attached photo) INPUT The only input entered by the user is an integer (between 1 to 5) which identifies which line number is to be analyzed by the program. OUTPUT Once the user runs the file, the program should be able to traverse through the tweets2 file and look for the line number indicated upon compile. Take note, that the line number is an integer from 1 to 5 only, as there are only 5 lines within the tweets2 file. Once the line number is encountered, the program should detect and count the number of stopwords, common words, unique words, and over all words. the program should be able to output a pythonic dictionary which contains the line number, and the corresponding counts of: stopwords, common words, unique words, and over all words. note: the output should be a dictionary tally of these counts. See the attached photo for sample inputs and outputs

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question
100%

Inside Files (Use Python)

Write a program that accepts an integer input, opens a file, and analyzes what and how many types of words are there in a line within the opened file.

PROGRAM DESIGN
The program should be able to accept an integer input. This program should be able to open and read a file called tweets2.txt. The integer input represents the order of the line (from 1st to 5th line), within the tweets2.txt file. The program should be able to count how many stopwords, common words, unique words, and overall words are there in the line number input.

In Natural Language Processing (NLP), stopwords are defined to be words with no meaning when left alone and with no context. For this activity, stopwords are words that are at most, 3 characters in length, with common words having more than 3 characters.

Unique words are words, within the line, that don’t have any duplicates. Whereas overall words are the over all count of all words within the line.

The program should also be able to filter out (remove) symbols from further processing.

Required file:
tweets2.txt file (See the attached photo)

INPUT
The only input entered by the user is an integer (between 1 to 5) which identifies which line number is to be analyzed by the program.

OUTPUT
Once the user runs the file, the program should be able to traverse through the tweets2 file and look for the line number indicated upon compile. Take note, that the line number is an integer from 1 to 5 only, as there are only 5 lines within the tweets2 file.

Once the line number is encountered, the program should detect and count the number of stopwords, common words, unique words, and over all words. the program should be able to output a pythonic dictionary which contains the line number, and the corresponding counts of: stopwords, common words, unique words, and over all words.

note: the output should be a dictionary tally of these counts.

See the attached photo for sample inputs and outputs.

SAMPLE
SAMPLE OUTPUT
INPUT
5
{'line': 5, 's': 10, 'c': 12, 'u': 16, 'o': 22}
{'line': 3, 's': 5, 'c': 10, 'u': 13, 'o': 15}
{'line': 1,
{'line': 2,
{'line': 4,
1.
's': 8, 'c': 15, 'u': 17, 'o': 23}
2
's': 6, 'c': 11, 'u': 13, 'o': 17}
's': 14, 'c': 9, 'u': 23, 'o': 23}
Transcribed Image Text:SAMPLE SAMPLE OUTPUT INPUT 5 {'line': 5, 's': 10, 'c': 12, 'u': 16, 'o': 22} {'line': 3, 's': 5, 'c': 10, 'u': 13, 'o': 15} {'line': 1, {'line': 2, {'line': 4, 1. 's': 8, 'c': 15, 'u': 17, 'o': 23} 2 's': 6, 'c': 11, 'u': 13, 'o': 17} 's': 14, 'c': 9, 'u': 23, 'o': 23}
tweets2 - Notepad
File Edit Format
View Help
REDACTED nagpost ng "Basta May Alak May valak" sa REDACTED. Ghaddd! Never knew they could do the 'thing' when they are still in.
I love REDACTED and Fiesta and all but can REDACTED host more academic-related events besides strand days???
One of cluster teachers namin sa REDACTED pero wala ko siya nateacher like sa class
i will crack a raw egg on my head if REDACTED move the resumption of classes to Jan 7. im not even kidding.
MAY MGA ESKWELAHAN TALAGA NA HINDI NAAAWA SA MGA TAGA-PROBINSIYA. HINDI KO SINASABING REDACTED TO HA PERO PARANG GANUN NA NGA HAHA
Transcribed Image Text:tweets2 - Notepad File Edit Format View Help REDACTED nagpost ng "Basta May Alak May valak" sa REDACTED. Ghaddd! Never knew they could do the 'thing' when they are still in. I love REDACTED and Fiesta and all but can REDACTED host more academic-related events besides strand days??? One of cluster teachers namin sa REDACTED pero wala ko siya nateacher like sa class i will crack a raw egg on my head if REDACTED move the resumption of classes to Jan 7. im not even kidding. MAY MGA ESKWELAHAN TALAGA NA HINDI NAAAWA SA MGA TAGA-PROBINSIYA. HINDI KO SINASABING REDACTED TO HA PERO PARANG GANUN NA NGA HAHA
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT