am 2cf55507: Fix: BoS prediction after inputting just once.

* commit '2cf5550749927a8f72766eb040adb7d8d15ba127':
  Fix: BoS prediction after inputting just once.
This commit is contained in:
Keisuke Kuroyanagi 2014-11-01 09:12:26 +00:00 committed by Android Git Automerger
commit a94d9ff0d9

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());
}
}