diff options
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | kgramstats.cpp | 9 |
2 files changed, 7 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am index 150ede2..299dc10 100644 --- a/Makefile.am +++ b/Makefile.am | |||
@@ -4,6 +4,5 @@ ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} | |||
4 | bin_PROGRAMS = rawr-ebooks rawr-gen | 4 | bin_PROGRAMS = rawr-ebooks rawr-gen |
5 | rawr_ebooks_SOURCES = ebooks.cpp kgramstats.cpp freevars.cpp | 5 | rawr_ebooks_SOURCES = ebooks.cpp kgramstats.cpp freevars.cpp |
6 | rawr_gen_SOURCES = gen.cpp kgramstats.cpp freevars.cpp | 6 | rawr_gen_SOURCES = gen.cpp kgramstats.cpp freevars.cpp |
7 | rawr_gen_CPPFLAGS = -std=c++11 | 7 | rawr_ebooks_CPPFLAGS = $(LIBTWITCURL_CFLAGS) $(YAML_CFLAGS) |
8 | rawr_ebooks_CPPFLAGS = $(LIBTWITCURL_CFLAGS) $(YAML_CFLAGS) -std=c++11 | ||
9 | rawr_ebooks_LDADD = $(LIBTWITCURL_LIBS) $(YAML_LIBS) \ No newline at end of file | 8 | rawr_ebooks_LDADD = $(LIBTWITCURL_LIBS) $(YAML_LIBS) \ No newline at end of file |
diff --git a/kgramstats.cpp b/kgramstats.cpp index 1f3dd3c..648a267 100644 --- a/kgramstats.cpp +++ b/kgramstats.cpp | |||
@@ -299,15 +299,18 @@ vector<string> kgramstats::randomSentence(int n) | |||
299 | return result; | 299 | return result; |
300 | } | 300 | } |
301 | 301 | ||
302 | bool removeIf(char c) | ||
303 | { | ||
304 | return !((c != '.') && (c != '"') && (c != '(') && (c != ')') && (c != ',')); | ||
305 | } | ||
306 | |||
302 | std::string canonize(std::string f) | 307 | std::string canonize(std::string f) |
303 | { | 308 | { |
304 | string canonical(f); | 309 | string canonical(f); |
305 | transform(canonical.begin(), canonical.end(), canonical.begin(), ::tolower); | 310 | transform(canonical.begin(), canonical.end(), canonical.begin(), ::tolower); |
306 | 311 | ||
307 | string result; | 312 | string result; |
308 | remove_copy_if(canonical.begin(), canonical.end(), std::back_inserter(result), [] (char c) { | 313 | remove_copy_if(canonical.begin(), canonical.end(), std::back_inserter(result), removeIf); |
309 | return !((c != '.') && (c != '"') && (c != '(') && (c != ')') && (c != ',')); | ||
310 | }); | ||
311 | 314 | ||
312 | return result; | 315 | return result; |
313 | } \ No newline at end of file | 316 | } \ No newline at end of file |