From d4db2fd99715dd731327cf485bd219331b6af781 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 19 Jul 2015 22:46:35 -0400 Subject: Took into account question marks and exclamation marks --- kgramstats.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'kgramstats.cpp') 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) newClause = false; } - if ((f.length() > 0) && (f[f.length()-1] == '.')) + if ((f.length() > 0) && ((f[f.length()-1] == '.') || (f[f.length()-1] == '!') || (f[f.length()-1] == '?'))) { td->period++; newSentence = true; @@ -301,7 +301,7 @@ vector kgramstats::randomSentence(int n) bool removeIf(char c) { - return !((c != '.') && (c != '"') && (c != '(') && (c != ')') && (c != ',')); + return !((c != '.') && (c != '?') && (c != '!') && (c != '"') && (c != '(') && (c != ')') && (c != ',')); } std::string canonize(std::string f) -- cgit 1.4.1