Question: Using PythonThe company quickly realized that the simple two-word thesaurus was far too small. In order to address this shortcoming they have provided you with

Using PythonThe company quickly realized that the simple two-word thesaurus was far too small. In order to address this shortcoming they have provided you with a very large text file that contains over 30,000 words. Copy this text-only thesaurus and save it in a file named python_asg10_Roget_Thesaurus.txt.

word1,synonym1,synonym2,...,synonymN-1,synonymNword2,synonym1,synonym2,...,synonymN-1,synonymNword3,synonym1,synonym2,...,synonymN-1,synonymN

Every word occupies its own line followed by a comma-separated list of synonyms. Every word can have a potentially unlimited # of synonyms. Your task for this part is to open this file and parse it into a Python dictionary object so that it functions just like the simple thesaurus from the previous part. Here's a sample running of your program: Total words in thesaurus: 33054

Enter a phrase: happy birthday said the sad kittenCONTENT ANNUAL HOLIDAY PRONOUNCED the DOLOROUS CHESHIRE CAT

Hint: For each word you will need to create a new list that contains all the synonyms for that word. You can then store this list in the dictionary using the word as the key.

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 Programming Questions!