C++ Spellchecking Program

Posted Under: C

Ask A Question
Viewed 11
I must create a program in C++ that is used to check the spelling of words and suggest corrections for misspelled words based on a distance method (I have already written the code for this method, as shown below). I must define a class Spellcheck for this, with public members: void load_dictionary(istream&); //copies words from an input stream into a SpellCheck's storage bool find(const string&) const; // returns true if it's input is in the dictionary, if not, false. vector suggest(const string&, size_t n) const; // returns a vector of words from dictionary (word suggestions) I must incorporate a dictionary in a .txt file using an ifstream, but can be a sample dictionary with a only a few words for sake of testing this. It was suggested we can use std::set from library for this, but I cannot figure out how to do it. -Name of the class must be SpellCheck, and member functions must be named exactly as above -Define the class in a file named spellcheck.h and implement it's ember functions in a file named spellcheck.cpp. These names are case sensitive. - It is ok to use my distance code and put in a separate file if needed. -The resultant output should use the distance formula (Levenshtein) to suggest words with the minimal number of character changes , insertions, or deletions required to transform one word to another. So for example, a sample output would be: if (!my_check.find("buble") { std::vector suggestions = my_check.suggest("buble",3); for (string s: suggestions) std::cout << s << std::endl; // "bible" // "bubble" // "bugle" Any help on putting the files and .h file together would be a big help, I have done the math portion but cannot get the rest right. Thank you

This order does not have tags, yet.


No uploads for this question

Explanations and Answers 0

No answers posted

Post your Answer - free or at a fee

Login to your tutor account to post an answer

Posting a free answer earns you +20 points.


NB: Post a homework question for free and get answers - free or paid homework help.

Get answers to: C++ Spellchecking Program or similar questions only at Tutlance.

Related Questions