about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2015-07-19 22:44:17 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2015-07-19 22:44:17 -0400
commitb73535bf6a392e894d914b17fa9df8bada0a8d14 (patch)
treecd8e759cc040c95a3a8cb60edfce2edd75732872
parente080a02518103538897be3f09a342712bd42c546 (diff)
downloadrawr-ebooks-b73535bf6a392e894d914b17fa9df8bada0a8d14.tar.gz
rawr-ebooks-b73535bf6a392e894d914b17fa9df8bada0a8d14.tar.bz2
rawr-ebooks-b73535bf6a392e894d914b17fa9df8bada0a8d14.zip
Stopped using C++11 because yamlcpp didn't like it
-rw-r--r--Makefile.am3
-rw-r--r--kgramstats.cpp9
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}
4bin_PROGRAMS = rawr-ebooks rawr-gen 4bin_PROGRAMS = rawr-ebooks rawr-gen
5rawr_ebooks_SOURCES = ebooks.cpp kgramstats.cpp freevars.cpp 5rawr_ebooks_SOURCES = ebooks.cpp kgramstats.cpp freevars.cpp
6rawr_gen_SOURCES = gen.cpp kgramstats.cpp freevars.cpp 6rawr_gen_SOURCES = gen.cpp kgramstats.cpp freevars.cpp
7rawr_gen_CPPFLAGS = -std=c++11 7rawr_ebooks_CPPFLAGS = $(LIBTWITCURL_CFLAGS) $(YAML_CFLAGS)
8rawr_ebooks_CPPFLAGS = $(LIBTWITCURL_CFLAGS) $(YAML_CFLAGS) -std=c++11
9rawr_ebooks_LDADD = $(LIBTWITCURL_LIBS) $(YAML_LIBS) \ No newline at end of file 8rawr_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
302bool removeIf(char c)
303{
304 return !((c != '.') && (c != '"') && (c != '(') && (c != ')') && (c != ','));
305}
306
302std::string canonize(std::string f) 307std::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