about summary refs log tree commit diff stats
path: root/malaprop.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2015-11-23 18:02:47 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2015-11-23 18:02:47 -0500
commita7127a63cc025ab3b95cde125a7c0db552603862 (patch)
tree7b49db419e82d49e0ccbc2f4283bb56b5ef54dc3 /malaprop.cpp
parentfae888f2de6365390fe1d9d69510f78cf2745b26 (diff)
downloadrawr-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.
Diffstat (limited to 'malaprop.cpp')
-rw-r--r--malaprop.cpp9
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
5bool removeIfM(char c) 7bool removeIfM(char c)
6{ 8{
@@ -87,8 +89,11 @@ malaprop::soundex malaprop::soundify(std::string f)
87void malaprop::addWord(std::string word) 89void 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
94void malaprop::stats() 99void malaprop::stats()