about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2016-03-10 09:28:08 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2016-03-10 09:28:08 -0500
commitd458c695e526e37059786821704527501ca04042 (patch)
tree0eb92aa67474640b89fd9214f79c3d1608677d0a
parent37fec8860a780f8974d026f84e3009ded21a308c (diff)
downloadrawr-ebooks-d458c695e526e37059786821704527501ca04042.tar.gz
rawr-ebooks-d458c695e526e37059786821704527501ca04042.tar.bz2
rawr-ebooks-d458c695e526e37059786821704527501ca04042.zip
Changed "full sentence mode" to "don't stop believing" mode
-rw-r--r--kgramstats.cpp15
1 files changed, 1 insertions, 14 deletions
diff --git a/kgramstats.cpp b/kgramstats.cpp index 38bf973..a44bf2b 100644 --- a/kgramstats.cpp +++ b/kgramstats.cpp
@@ -607,23 +607,10 @@ std::string kgramstats::randomSentence(int maxL)
607 607
608 result.append(nextToken + " "); 608 result.append(nextToken + " ");
609 609
610 if ((next.tok.suffix == suffixtype::terminating) && (rand() % 4 == 0)) 610 if ((next.tok.suffix == suffixtype::terminating) && ((result.length() > maxL) || (rand() % 4 == 0)))
611 { 611 {
612 break; 612 break;
613 } 613 }
614
615 // Went over the limit, so reset
616 if (result.length() > maxL)
617 {
618 result = "";
619 cur = kgram(1, wildcardQuery);
620 cuts = 0;
621
622 while (!open_delimiters.empty())
623 {
624 open_delimiters.pop();
625 }
626 }
627 } 614 }
628 615
629 // Remove the trailing space 616 // Remove the trailing space