subject

In this program, you will build an English to Hmong translator program. Hmong is a language widely spoken by most Southeast Asian 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:
In this python program, you will build an English to Hmong translator program. Hmong is a language widely spoken by most Southeast Asian 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:
load_dictionary(filename)
Read the file containing the tuples, insert the entries into the dictionary and return the dictionary object.
translate(sentence)
Take a sentence in English and return a sentence in English.
print_word_frequency()
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 translate each word in Hmong and print the Hmong words in a sentence. If an English word does not exist in the dictionary, it uses ? 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 (Y/N): Y
Type your English sentence: You can help me.
Hmong: koj tau pab kuv.
Another translation (Y/N): N
Word Frequency

i 1
can 2
you 2
help 2
him 1
The main loop:
The program prompts the user for an English sentence. It translate each word in Hmong and print 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 (Y/N): Y
Type your English sentence: You can help me.
Hmong: koj tau pab kuv.
Another translation (Y/N): N
Word Frequency

I 1
can 2
you 1
help 2
him 1
me 1

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:30
Singing in the rain: this first part of the film shows the early history of motion picture. how accurate do you think the portrayal of the early motion picture industry is? why? is historical accuracy important in films and theater productions? explain.
Answers: 1
question
Computers and Technology, 22.06.2019 19:50
Write a car class having two private member variables called tank and speed. write public methods called pumpgas and gofast. the method pumpgas gets an integer for gas that must be pumped. that value needs to be added to tank (no more than 20 gallons). it must return the amount of gas that is purchased ($4 per gallon). the method gofast should increase the speed by 5 each time it is called.write a constructor for the above class that initialized both variables to zero.write a tostring to display both the tank and speed when the car is printed.modify the car class to implement the interface comparable and an interface called carinter having the public methods in carinter.write the main program to create an array of size 5 of type car. create 5 car objects having each location of the array to refer to one of the cars. test the pumpgas, gofast, equals method on the array items. write an enhanced loop to print all the car values (using a tostring written last time).write a generic method to find the minimum of four items. pass int, double, char, string and car objects to test this method.
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Quick pl which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
question
Computers and Technology, 24.06.2019 21:50
The use of phrases, fragments, and punctuation can influence the mood of a passage; keeping this in mind, how would you describe the mood of the followingpassage? "fog on the essex marshes, fog on the kentish heights, fog creeping into the cabooses of collier-brigs; fog lying out on the yards, and hovering in the riggingof great ships; fog drooping on the gunwales of barges and small boats. fog in the eyes and throats of ancient greenwich pensioners, wheezing by thefiresides of their wards; fog in the stem and bowl of the afternoon pipe of the wrathful skipper; fog cruelly pinching the toes and fingers of his shivering little'prentice boy on deck." (5 points)
Answers: 2
You know the right answer?
In this program, you will build an English to Hmong translator program. Hmong is a language widely s...
Questions
question
History, 26.07.2019 00:30
question
World Languages, 26.07.2019 00:30
Questions on the website: 13722367