about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2015-11-26 12:38:53 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2015-11-26 12:38:53 -0500
commit99308c2be2f6c1bff74706c006d07e3c137ba8d8 (patch)
tree89326108f70134b112f6052680092e2a539f62aa
parent006c6502872cfc51eafd1df06ccb01c3c140a1ed (diff)
downloadrawr-ebooks-99308c2be2f6c1bff74706c006d07e3c137ba8d8.tar.gz
rawr-ebooks-99308c2be2f6c1bff74706c006d07e3c137ba8d8.tar.bz2
rawr-ebooks-99308c2be2f6c1bff74706c006d07e3c137ba8d8.zip
????
-rw-r--r--malaprop.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/malaprop.cpp b/malaprop.cpp index 7fbdb6c..c308d34 100644 --- a/malaprop.cpp +++ b/malaprop.cpp
@@ -117,6 +117,12 @@ std::string malaprop::alternate(std::string word)
117{ 117{
118 soundex ex = soundify(word); 118 soundex ex = soundify(word);
119 std::set<std::string>& opts = dict[ex]; 119 std::set<std::string>& opts = dict[ex];
120 if (opts.size() == 0)
121 {
122 // Not sure why this can even happen but it is happenining????
123 return word;
124 }
125
120 int opt = rand() % opts.size(); 126 int opt = rand() % opts.size();
121 for (std::set<std::string>::iterator it = opts.begin(); it != opts.end(); it++) 127 for (std::set<std::string>::iterator it = opts.begin(); it != opts.end(); it++)
122 { 128 {