am 2cf55507
: Fix: BoS prediction after inputting just once.
* commit '2cf5550749927a8f72766eb040adb7d8d15ba127': Fix: BoS prediction after inputting just once.
This commit is contained in:
commit
a94d9ff0d9
1 changed files with 10 additions and 2 deletions
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue