diff options
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 */ | ||