diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-02-17 21:04:49 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-02-17 21:04:49 -0500 |
commit | b090f6db27534d0bd0bbfaf068efada7b30aa5ac (patch) | |
tree | f4b914187f92417a64fe0ec06d049d23756ee05f | |
parent | 033d696ceb6f674252ee31c98db396ba4d10481f (diff) | |
download | rawr-ebooks-b090f6db27534d0bd0bbfaf068efada7b30aa5ac.tar.gz rawr-ebooks-b090f6db27534d0bd0bbfaf068efada7b30aa5ac.tar.bz2 rawr-ebooks-b090f6db27534d0bd0bbfaf068efada7b30aa5ac.zip |
Modified kgram cut rate. It's do or die.
-rw-r--r-- | kgramstats.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/kgramstats.cpp b/kgramstats.cpp index 3c5a4ee..8a21d60 100644 --- a/kgramstats.cpp +++ b/kgramstats.cpp | |||
@@ -429,18 +429,21 @@ std::string kgramstats::randomSentence(int n) | |||
429 | 429 | ||
430 | if (cur.size() > 0) | 430 | if (cur.size() > 0) |
431 | { | 431 | { |
432 | if (rand() % (maxK - cur.size() + 1) == 0) | 432 | while ((cur.size() > 1) && (cuts > 0)) |
433 | { | 433 | { |
434 | while ((cur.size() > 1) && (cuts > 0)) | 434 | int under = maxK - cur.size(); |
435 | int tunder = i - 1; | ||
436 | for (int j = 0; j < under; j++) | ||
435 | { | 437 | { |
436 | int under = maxK - cur.size() + 1; | 438 | tunder /= 2; |
437 | if ((rand() % cuts) > (under * under)) | 439 | } |
438 | { | 440 | |
439 | cur.pop_front(); | 441 | if ((rand() % cuts) < tunder) |
440 | cuts -= under * under; | 442 | { |
441 | } else { | 443 | cur.pop_front(); |
442 | break; | 444 | cuts -= under; |
443 | } | 445 | } else { |
446 | break; | ||
444 | } | 447 | } |
445 | } | 448 | } |
446 | } | 449 | } |