From 01746a0e03267b6c082b58436c1370567f7cb7c5 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 22 Nov 2015 18:49:58 -0500 Subject: Added malapropisms --- malaprop.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 malaprop.h (limited to 'malaprop.h') diff --git a/malaprop.h b/malaprop.h new file mode 100644 index 0000000..91a18eb --- /dev/null +++ b/malaprop.h @@ -0,0 +1,31 @@ +#ifndef MALAPROP_H_8F382336 +#define MALAPROP_H_8F382336 + +#include +#include +#include + +class malaprop +{ +public: + void addWord(std::string word); + void stats(); + std::string alternate(std::string word); + +private: + struct soundex { + char prefix; + int code; + + bool operator<(const soundex& other) const + { + return (prefix < other.prefix) || (code < other.code); + } + }; + + std::map > dict; + + soundex soundify(std::string l); +}; + +#endif /* end of include guard: MALAPROP_H_8F382336 */ -- cgit 1.4.1