From 73821856c9648d030f4d148d2bc50f07f43ad369 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 8 Mar 2016 14:37:16 -0500 Subject: Full sentences mode! --- kgramstats.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'kgramstats.cpp') diff --git a/kgramstats.cpp b/kgramstats.cpp index 933165a..899ad20 100644 --- a/kgramstats.cpp +++ b/kgramstats.cpp @@ -457,14 +457,14 @@ void printKgram(kgram k) } // runs in O(n log t) time where n is the input number of sentences and t is the number of tokens in the input corpus -std::string kgramstats::randomSentence(int n) +std::string kgramstats::randomSentence(int max) { std::string result; kgram cur(1, wildcardQuery); int cuts = 0; std::stack open_delimiters; - for (int i=0; i max) + { + result = ""; + cur = kgram(1, wildcardQuery); + cuts = 0; + + while (!open_delimiters.empty()) + { + open_delimiters.pop(); + } + } } // Remove the trailing space -- cgit 1.4.1