Fix: BoS prediction after inputting just once.

Change-Id: Ib69569ab6b6edfcc8c1d2c621b95de4127789ab6
This commit is contained in:
Keisuke Kuroyanagi 2014-11-01 17:27:26 +09:00
parent 2af3fc3275
commit 2cf5550749

View file

@ -146,8 +146,16 @@ void Ver4PatriciaTriePolicy::iterateNgramEntries(const WordIdArrayView prevWordI
if (!probabilityEntry.isValid()) {
continue;
}
const int probability = probabilityEntry.hasHistoricalInfo() ?
0 : probabilityEntry.getProbability();
int probability = NOT_A_PROBABILITY;
if (probabilityEntry.hasHistoricalInfo()) {
// TODO: Quit checking count here.
// If count <= 1, the word can be an invaild word. The actual probability should
// be checked using getWordAttributesInContext() in onVisitEntry().
probability = probabilityEntry.getHistoricalInfo()->getCount() <= 1 ?
NOT_A_PROBABILITY : 0;
} else {
probability = probabilityEntry.getProbability();
}
listener->onVisitEntry(probability, entry.getWordId());
}
}