diff options
-rw-r--r-- | kgramstats.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/kgramstats.cpp b/kgramstats.cpp index 4a7eb9d..c674e80 100644 --- a/kgramstats.cpp +++ b/kgramstats.cpp | |||
@@ -578,11 +578,16 @@ std::string rawr::randomSentence(int maxL) const | |||
578 | cur.pop_front(); | 578 | cur.pop_front(); |
579 | } | 579 | } |
580 | 580 | ||
581 | if ((cur.size() > 2) && (cuts > 0) && ((rand() % cuts) > 0)) | 581 | do |
582 | { | 582 | { |
583 | cur.pop_front(); | 583 | if ((cur.size() > 2) && (cuts > 0) && ((rand() % cuts) > 0)) |
584 | cuts /= 2; | 584 | { |
585 | } | 585 | cur.pop_front(); |
586 | cuts--; | ||
587 | } else { | ||
588 | break; | ||
589 | } | ||
590 | } while ((cur.size() > 2) && (cuts > 0) && ((rand() % cuts) > 0)); | ||
586 | 591 | ||
587 | // Gotta circumvent the last line of the input corpus | 592 | // Gotta circumvent the last line of the input corpus |
588 | // https://twitter.com/starla4444/status/684222271339237376 | 593 | // https://twitter.com/starla4444/status/684222271339237376 |
@@ -711,7 +716,7 @@ std::string rawr::randomSentence(int maxL) const | |||
711 | cuts++; | 716 | cuts++; |
712 | } else if (cuts > 0) { | 717 | } else if (cuts > 0) { |
713 | // Otherwise, decrease cut chance | 718 | // Otherwise, decrease cut chance |
714 | cuts--; | 719 | cuts /= 2; |
715 | } | 720 | } |
716 | 721 | ||
717 | if (next.corpora.size() == 1) | 722 | if (next.corpora.size() == 1) |