diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-11-23 18:02:47 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-11-23 18:02:47 -0500 |
commit | a7127a63cc025ab3b95cde125a7c0db552603862 (patch) | |
tree | 7b49db419e82d49e0ccbc2f4283bb56b5ef54dc3 | |
parent | fae888f2de6365390fe1d9d69510f78cf2745b26 (diff) | |
download | rawr-ebooks-a7127a63cc025ab3b95cde125a7c0db552603862.tar.gz rawr-ebooks-a7127a63cc025ab3b95cde125a7c0db552603862.tar.bz2 rawr-ebooks-a7127a63cc025ab3b95cde125a7c0db552603862.zip |
std::set seems to have some problem with inserting an empty string. Warrants further investigation.
-rw-r--r-- | malaprop.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/malaprop.cpp b/malaprop.cpp index bfea579..7fbdb6c 100644 --- a/malaprop.cpp +++ b/malaprop.cpp | |||
@@ -1,6 +1,8 @@ | |||
1 | #include "malaprop.h" | 1 | #include "malaprop.h" |
2 | #include <cstdlib> | 2 | #include <cstdlib> |
3 | #include <iostream> | 3 | #include <iostream> |
4 | #include <algorithm> | ||
5 | #include <cstdio> | ||
4 | 6 | ||
5 | bool removeIfM(char c) | 7 | bool removeIfM(char c) |
6 | { | 8 | { |
@@ -87,8 +89,11 @@ malaprop::soundex malaprop::soundify(std::string f) | |||
87 | void malaprop::addWord(std::string word) | 89 | void malaprop::addWord(std::string word) |
88 | { | 90 | { |
89 | soundex ex = soundify(word); | 91 | soundex ex = soundify(word); |
90 | 92 | ||
91 | dict[ex].insert(canonizetwo(word)); | 93 | if (ex.prefix != 0) |
94 | { | ||
95 | dict[ex].insert(canonizetwo(word)); | ||
96 | } | ||
92 | } | 97 | } |
93 | 98 | ||
94 | void malaprop::stats() | 99 | void malaprop::stats() |