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, 23.06.2019 11:00
Describe three characteristics of at-risk drivers. a. b. c. describe three characteristics of safe drivers. a. b. c. describe three driver errors that could cause a collision. a. b. c. how will this information affect you as a driver now and in the future? (2-3 sentences)
Answers: 2
question
Computers and Technology, 24.06.2019 00:00
The gene form of a trait is called a(n) 
Answers: 2
question
Computers and Technology, 24.06.2019 08:30
Aconsumer would pay an extra they used the rent to own program to buy the computer, rather than using cash. for all of the items, is the cheapest option over the life of the contract. the most expensive overall option is to use purchase the item.
Answers: 2
question
Computers and Technology, 24.06.2019 09:50
Create a string list. 2. use console.readline() to collect values of firstname, lastname, street, city, state, zip, save them to list. 3. write a simple linq statement, call method uppercasewords() to change first letter to uppercase. 4. create a foreach statment to display the information. public static string uppercasewords(string value) { char[] array = value.tochararray(); if (array.length > = 1) { if (char.islower(array[0])) { array[0] = char.toupper(array[0]); } } for (int i = 1; i < array.length; i++) { if (array[i - 1] == ' ') { if (char.islower(array[i])) { array[i] = char.toupper(array[i]); } } } return new string(array);
Answers: 3
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
Mathematics, 23.10.2020 20:10
question
Arts, 23.10.2020 20:10
Questions on the website: 13722359