integer overflows in Good-Turing discounting

This commit is contained in:
Matthias Huck 2015-03-30 17:42:55 +01:00
parent 6ce3060dd8
commit 633e7be8f0

View File

@ -687,7 +687,8 @@ void outputPhrasePair(const ExtractionPhrasePair &phrasePair,
if (goodTuringFlag || kneserNeyFlag) {
totalDistinct++;
int countInt = count + 0.99999;
if (countInt <= COC_MAX)
if ((countInt <= COC_MAX) &&
(countInt > 0))
countOfCounts[ countInt ]++;
}