diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-11-22 18:49:58 -0500 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-11-22 18:49:58 -0500 |
| commit | 01746a0e03267b6c082b58436c1370567f7cb7c5 (patch) | |
| tree | e3cfeadb97f93858f326f57958bff4675cd8f9ed /malaprop.h | |
| parent | 294fe00911c6ee0dd9853df7612dcdbd63425c05 (diff) | |
| download | rawr-ebooks-01746a0e03267b6c082b58436c1370567f7cb7c5.tar.gz rawr-ebooks-01746a0e03267b6c082b58436c1370567f7cb7c5.tar.bz2 rawr-ebooks-01746a0e03267b6c082b58436c1370567f7cb7c5.zip | |
Added malapropisms
Diffstat (limited to 'malaprop.h')
| -rw-r--r-- | malaprop.h | 31 |
1 files changed, 31 insertions, 0 deletions
| diff --git a/malaprop.h b/malaprop.h new file mode 100644 index 0000000..91a18eb --- /dev/null +++ b/malaprop.h | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | #ifndef MALAPROP_H_8F382336 | ||
| 2 | #define MALAPROP_H_8F382336 | ||
| 3 | |||
| 4 | #include <string> | ||
| 5 | #include <map> | ||
| 6 | #include <set> | ||
| 7 | |||
| 8 | class malaprop | ||
| 9 | { | ||
| 10 | public: | ||
| 11 | void addWord(std::string word); | ||
| 12 | void stats(); | ||
| 13 | std::string alternate(std::string word); | ||
| 14 | |||
| 15 | private: | ||
| 16 | struct soundex { | ||
| 17 | char prefix; | ||
| 18 | int code; | ||
| 19 | |||
| 20 | bool operator<(const soundex& other) const | ||
| 21 | { | ||
| 22 | return (prefix < other.prefix) || (code < other.code); | ||
| 23 | } | ||
| 24 | }; | ||
| 25 | |||
| 26 | std::map<soundex, std::set<std::string> > dict; | ||
| 27 | |||
| 28 | soundex soundify(std::string l); | ||
| 29 | }; | ||
| 30 | |||
| 31 | #endif /* end of include guard: MALAPROP_H_8F382336 */ | ||
