Question: C++ Question: Using only these libraries, , , , , perform the following: Write a program pronounce.cpp that Lets the user input a word (lets
C++ Question: Using only these libraries,
Write a program pronounce.cpp that
Lets the user input a word (lets call the input word W).
If the word is not found in the dictionary, print Not found. Otherwise, report:
Pronunciation : the pronunciation of the word W (as given in the dictionary),
Identical : other words from the dictionary with the same pronunciation as W,
Add phoneme : words that can be obtained from W by adding one phoneme,
Remove phoneme : words that can be obtained from W by removing one phoneme,
Replace phoneme : words that can be obtained from W by replacing one phoneme.
When listing words, include all words from the dictionary that meet the criteria, the order of listed words should be the same as they appear in the dictionary.
Your program should expect that the dictionary file cmudict.0.7a is located in the current working directory.
User input should be case-insensitive (accepting donut, DONUT, DOnUt, etc.)
The program should also ignore all words that contain non-alphabetic characters. The only non-letter character that is allowed in a word is apostrophe '.
Must also use the function specified,
void splitOnSpace(string s, string & before, string & after) { // reset strings before = ""; after = ""; // accumulate before space int i = 0; while (i < s.size() && not isspace(s[i])) { before += s[i]; i++; } // skip the space i++; // accumulate after space while (i < s.size()) { after += s[i]; i++; } } Note : Reads from a dictionary.txt file, and this helper function separates the text into two strings; "before" being the words in the dictionary (ie: PROGRAM) and "after" being the pronunciation (ie: "P R OW1 G R AE2 M")
I am really struggling with this question and any help is appreciated. Please let me know if I did not provide enough of the prompt, and if it is helpful, I can show what I have already came up with.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
