Question: Write code in python Q3) WordFrequency.py (40 Points) Write a program that reads the contents of a text file. The program should create a dictionary

Write code in python

Write code in python Q3) WordFrequency.py (40 Points) Write a program that

Q3) WordFrequency.py (40 Points) Write a program that reads the contents of a text file. The program should create a dictionary in which the keys are the individual words found in the file and the values are the number of times each word appears. For example, if the word "the" appears 28 times, the dictionary would contain an element with the' as the key and 28 as the value. Display the dictionary on the command line/Terminal. The program should write the word and its frequency to a different file WordFreq.txt If the input file contains the following text, Baseball is a sport that dates back as far as 1744 and formats of the game have been in place until the modern era today. The game is predominantly big in North America, Canada and Japan. The game is played worldwide with the pinnacle of sport coming from the world Series of Basebal1. Ironically this event is only competed by North American teams Spring 2018 MIS 15 HOMEWORK5 The output file should contain back basebal1 2 dates formats game north place sport the Total number of words = 62 Prompt the user for input file. If the input file doesn't exit, display a message "Input file not found. Please re-enter." Allow the user to enter the file name one more time. If the user enters it incorrectly, then terminate the program. Use try...except logic. . Remove punctuation marks at the end of the words to get the actual word .If the input file contains numbers (integers or floating point), the program should ignore those. The, and the' should be considered as same. Meaning, convert all words into lowercase. .The output file should display the frequency in the alphabetical order

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!