about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorFeffernoose <fefferburbia@gmail.com>2013-10-04 14:49:11 -0400
committerFeffernoose <fefferburbia@gmail.com>2013-10-04 14:49:11 -0400
commit92a4a0e7db8336f8ccc11c053dc29847a303ad88 (patch)
tree76759f019766f36d2cdc83fcdb1da224cc38d089
parent420a7a1e004410f1377a6d919d72d18f8ae34bdf (diff)
downloadrawr-ebooks-92a4a0e7db8336f8ccc11c053dc29847a303ad88.tar.gz
rawr-ebooks-92a4a0e7db8336f8ccc11c053dc29847a303ad88.tar.bz2
rawr-ebooks-92a4a0e7db8336f8ccc11c053dc29847a303ad88.zip
Changed incidence of random kgram-trimming
Also added better terminal output
-rw-r--r--kgramstats.cpp14
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 }