Question: CSC 1 1 5 Program 5 Topic: Dictionary In this program, you will build an English to Hmong translator program. Hmong is a language widely
CSC Program
Topic: Dictionary
In this program, you will build an English to Hmong translator program. Hmong is a language widely spoken by most Southeast Asians living in the Twin Cities.
The program lets the user type in a sentence in English and then translate it to a Hmong sentence. The program does not care about grammar or punctuation marks. That means your program should remove punctuation marks from the English words before attempt to translate them. Make sure it is case insensitive. You are given a file containing tuples of entry number, English word, and Hmong word.
If the dictionary does not contain the English word, simply put a question mark as the translation. Your program should consists of the following functions:
loaddictionaryfilename Read the file containing the tuples, insert the entries into the dictionary and return the dictionary object.
translatesentence Take a sentence in English and return a sentence in English. printwordfrequencydictionary Print the frequency of English words that were translated. main The main logic loop.
The main loop:
The program prompts the user for an English sentence. It translates each word in Hmong and prints the Hmong words in a sentence. If an English word does not exist in the dictionary, it uses a as the Hmong translation of that word. Each time the program finishes translating, it asks the user if they want to continue. If not, it displays the English words and the number of time the words have been entered into the program. See sample run below.
Sample run:
Type your English sentence: I can help you help him. Hmong: kuv tau pab koj pab nws Another translation YN: Y Type your English sentence: You can help me
Hmong: koj tau pab kuv. Another translation YN: N Word Frequency
I
can
you
help him
me
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
