Question: Write a module, most_common.py, with a function to determine the 5 most common words in a string using a dictionary. Your function should take a

Write a module, most_common.py, with a function to determine the 5 most common words in a string using a dictionary. Your function should take a string as a parameter and return a list of the 5 most common words in that string.

Within the main body of your code, define a tuple of at least 3 text passages, each of which should have 5 or more sentences. You may use any sample texts youd like quotes from your favorite books/movies/TV shows, excerpts from famous speeches, etc. just look them up on Google and copy and paste! Here is a link to a site with movie quotes to save you time: http://www.filmsite.org/greatfilmquotes.html.

Your program should print out a menu to the user with the titles of the passages in your tuple (consider using another function to do this) and allow them to select which excerpt to count the common words in. Then, call your function with the chosen text passed in as an argument, and print out the returned value of the 5 most common words in the text.

Finally, allow the user to choose whether or not to pick another text to analyze. If they choose yes, print out the menu again and repeat. If not, end the program.

Your program will be evaluated for correctness, elegance, and adherence to all requirements as specified in the project document. In particular, you should make sure your code is properly commented and obeys standard naming conventions. Also, consider how this program could be made more elegant by leveraging functions

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!