Question: Help!!! Task 2: a) Write a function that accepts a file name, counts the frequencies of all the words, and returns the result as a

 Help!!! Task 2: a) Write a function that accepts a file

Help!!!

Task 2: a) Write a function that accepts a file name, counts the frequencies of all the words, and returns the result as a dictionary with words as keys and frequencies as values. b) Use the provided text file (alice.txt) as your input file to your function in step a), and Obtain the word frequencies in the book Alice in Wonderland by Lewis Carrol. Write the following information to an output file ('most_frequent_alice.txt'): i. Total number of unique words in the book ii. Top 20 most used words and their frequencies Tips: For small paragraph and/or a single string, it is okay to process the whole paragraph/string at once. However, for larger documents, it is better to process each line at a time. Convert everything to lower case, as such, Cat' and cat will be considered as same word. Remove punctuations and special symbols from your text. Use the following code to achieve that: # replace each punctuation character with a space for ch in '!"#$%& () *+,-./:;?

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!