diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-07-19 22:46:35 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-07-19 22:46:35 -0400 |
commit | d4db2fd99715dd731327cf485bd219331b6af781 (patch) | |
tree | ae4d6aee1b9d6076d2674597725eca65655230a4 | |
parent | b73535bf6a392e894d914b17fa9df8bada0a8d14 (diff) | |
download | rawr-ebooks-d4db2fd99715dd731327cf485bd219331b6af781.tar.gz rawr-ebooks-d4db2fd99715dd731327cf485bd219331b6af781.tar.bz2 rawr-ebooks-d4db2fd99715dd731327cf485bd219331b6af781.zip |
Took into account question marks and exclamation marks
-rw-r--r-- | kgramstats.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kgramstats.cpp b/kgramstats.cpp index 648a267..b0c3940 100644 --- a/kgramstats.cpp +++ b/kgramstats.cpp | |||
@@ -79,7 +79,7 @@ kgramstats::kgramstats(string corpus, int maxK) | |||
79 | newClause = false; | 79 | newClause = false; |
80 | } | 80 | } |
81 | 81 | ||
82 | if ((f.length() > 0) && (f[f.length()-1] == '.')) | 82 | if ((f.length() > 0) && ((f[f.length()-1] == '.') || (f[f.length()-1] == '!') || (f[f.length()-1] == '?'))) |
83 | { | 83 | { |
84 | td->period++; | 84 | td->period++; |
85 | newSentence = true; | 85 | newSentence = true; |
@@ -301,7 +301,7 @@ vector<string> kgramstats::randomSentence(int n) | |||
301 | 301 | ||
302 | bool removeIf(char c) | 302 | bool removeIf(char c) |
303 | { | 303 | { |
304 | return !((c != '.') && (c != '"') && (c != '(') && (c != ')') && (c != ',')); | 304 | return !((c != '.') && (c != '?') && (c != '!') && (c != '"') && (c != '(') && (c != ')') && (c != ',')); |
305 | } | 305 | } |
306 | 306 | ||
307 | std::string canonize(std::string f) | 307 | std::string canonize(std::string f) |