about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2019-02-27 21:51:05 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2019-02-27 21:51:05 -0500
commitd7addd0adc6b42a1e10d92b96d27ab484049dd8e (patch)
tree1c09ec9250ef430c5aaded4d20cfa2e1dfb831c5
parentd75685e69f9a5d3cfc255aa921005fc40ae6e585 (diff)
downloadrawr-ebooks-d7addd0adc6b42a1e10d92b96d27ab484049dd8e.tar.gz
rawr-ebooks-d7addd0adc6b42a1e10d92b96d27ab484049dd8e.tar.bz2
rawr-ebooks-d7addd0adc6b42a1e10d92b96d27ab484049dd8e.zip
Fixed crash when maxK is greater than a corpus's length
-rw-r--r--kgramstats.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/kgramstats.cpp b/kgramstats.cpp index 30d4407..37830e4 100644 --- a/kgramstats.cpp +++ b/kgramstats.cpp
@@ -396,7 +396,7 @@ void rawr::compile(int maxK)
396 int corpid = 0; 396 int corpid = 0;
397 for (auto corpus : tokens) 397 for (auto corpus : tokens)
398 { 398 {
399 for (int k=1; k<maxK; k++) 399 for (int k=1; k<maxK && k<corpus.size(); k++)
400 { 400 {
401 for (int i=0; i<(corpus.size() - k); i++) 401 for (int i=0; i<(corpus.size() - k); i++)
402 { 402 {