about summary refs log tree commit diff stats
path: root/kgramstats.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kgramstats.cpp')
-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