diff options
| -rw-r--r-- | kgramstats.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
| diff --git a/kgramstats.cpp b/kgramstats.cpp index 7ece80f..b0a83dc 100644 --- a/kgramstats.cpp +++ b/kgramstats.cpp | |||
| @@ -625,6 +625,13 @@ std::string rawr::randomSentence(int maxL) const | |||
| 625 | // https://twitter.com/starla4444/status/684222271339237376 | 625 | // https://twitter.com/starla4444/status/684222271339237376 |
| 626 | if (_stats.count(cur) == 0) | 626 | if (_stats.count(cur) == 0) |
| 627 | { | 627 | { |
| 628 | // The end of a corpus should probably be treated like a terminator, so | ||
| 629 | // maybe we should just end here. | ||
| 630 | if ((result.length() > maxL) || (rand() % 4 == 0)) | ||
| 631 | { | ||
| 632 | break; | ||
| 633 | } | ||
| 634 | |||
| 628 | cur = kgram(1, wildcardQuery); | 635 | cur = kgram(1, wildcardQuery); |
| 629 | } | 636 | } |
| 630 | 637 | ||
