diff options
-rw-r--r-- | kgramstats.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/kgramstats.cpp b/kgramstats.cpp index 708013f..d196e8f 100644 --- a/kgramstats.cpp +++ b/kgramstats.cpp | |||
@@ -76,7 +76,7 @@ vector<string> kgramstats::randomSentence(int n) | |||
76 | 76 | ||
77 | for (int i=0; i<n; i++) | 77 | for (int i=0; i<n; i++) |
78 | { | 78 | { |
79 | if ((rand() % 4) != 0) | 79 | if ((rand() % (maxK - cur.size() + 1)) == 0) |
80 | { | 80 | { |
81 | for (int i=0; i<cur.size(); i++) | 81 | for (int i=0; i<cur.size(); i++) |
82 | { | 82 | { |
@@ -124,14 +124,20 @@ vector<string> kgramstats::randomSentence(int n) | |||
124 | { | 124 | { |
125 | nextToken += "."; | 125 | nextToken += "."; |
126 | } | 126 | } |
127 | |||
128 | cout << next->first << " | " << nextToken << endl; | ||
129 | 127 | ||
130 | if (cur.size() == maxK) | 128 | if (cur.size() == maxK) |
131 | { | 129 | { |
132 | cur.pop_front(); | 130 | cur.pop_front(); |
133 | } | 131 | } |
134 | 132 | ||
133 | /* DEBUG */ | ||
134 | for (kgram::iterator it = cur.begin(); it != cur.end(); it++) | ||
135 | { | ||
136 | cout << *it << " "; | ||
137 | } | ||
138 | |||
139 | cout << "-> \"" << nextToken << "\" (" << next->second->all << "/" << max << ")" << endl; | ||
140 | |||
135 | cur.push_back(next->first); | 141 | cur.push_back(next->first); |
136 | result.push_back(nextToken); | 142 | result.push_back(nextToken); |
137 | } | 143 | } |