subject

The program 4 should first tell users that this is a word analysis file. For any user-given text file, the program will read, analyze, and write each word with the line numbers where the word is found in an output file. A word may appear in multiple lines. A word shows more than once at a line, the line number will be only recorded one time. Ask a user to enter the name of a text file. Using try/except for invalid user input. Then the program reads the contents of the text file and create a dictionary in which the key-value pairs are described as follows:" Key. The key are the individual words found in the file. "Value. Each value is a list that contains the line numbers in the file where the word (the key) is found. Be aware that a list may have only one element. Once the dictionary has been built, the program should create another text file, named "word_index. txt". Next, write the contents of the dictionary to the file as an alphabetical listing of the words that are stored as keys in the dictionary (sorting the keys), along with the line numbers where the words appear in the original file. Please see the sample file for reference. Looking to seeing everyone to submit a well-done program! Here are some tips: "Documents/Comments of your program (Never more) "Testing your program by the given two files, Kennedy. txt and romeo. txt. The output file of the Kennedy. txt, "Kennedy_index. txt" and the output file for romeo. txt, "romeo_index. txt,. Please compare your program files with them. "Text File to be analyzed: romeo. txtArise: 5But: 1It: 3Juliet: 3Who: 7already: 7and: 3, 5, 7breaks: 1east: 3envious: 5fair: 5grief: 7is: 3, 7kill: 5light: 1moon: 5pale: 7sick: 7soft: 1sun: 3, 5the: 3, 5through: 1what: 1window: 1with: 7yonder: 1Text File to be analyzed: Kennedy. txtWe: 1a: 1, 2, 4an: 3as: 4, 5, 6beginning: 4but: 2celebration: 2change: 6end: 3freedom: 3not: 1observe: 1of: 2, 3party: 2renewal: 5signifying: 5symbolizing: 3today: 1victory: 1well: 4, 5romeo. txt But soft what light through yonder window breaks It is the east and Juliet is the sun Arise fair sun and kill the envious moon Who is already sick and pale with griefKennedy. txt We observe today not a victory of party but a celebration of freedom symbolizing an end as well as a beginning signifying renewal as well as change

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:30
What kind of software users of all skill levels create web pages that include graphics, video, audio, animation, and other special effects? website authoring website software website publishing website editing
Answers: 1
question
Computers and Technology, 22.06.2019 23:30
Which of the following is not a symptom of chronic fatigue syndrome
Answers: 2
question
Computers and Technology, 22.06.2019 23:30
What does 21 pilots middle aged name as a band 15 years prior to them naming their band 21 pilots?
Answers: 1
question
Computers and Technology, 24.06.2019 14:00
When creating a field in a table, you must set the to determine what type of data the field can store. field property data type field type data property
Answers: 1
You know the right answer?
The program 4 should first tell users that this is a word analysis file. For any user-given text fil...
Questions
question
Biology, 25.02.2021 23:30
question
Mathematics, 25.02.2021 23:30
question
Mathematics, 25.02.2021 23:30
question
Mathematics, 25.02.2021 23:40
question
Mathematics, 25.02.2021 23:40
Questions on the website: 13722367