Fix: BoS prediction is shown after inputting just once.
Change-Id: Ibba209f47cb5b1a4b08281689d607711b8dcfad4main
parent
dbeed7e4d8
commit
ca17ed7d9d
|
@ -428,7 +428,10 @@ bool Ver4PatriciaTriePolicy::updateCounter(const PrevWordsInfo *const prevWordsI
|
|||
AKLOGE("Cannot update unigarm entry in updateCounter().");
|
||||
return false;
|
||||
}
|
||||
const NgramProperty ngramProperty(wordCodePoints.toVector(), probability, historicalInfo);
|
||||
const int probabilityForNgram = prevWordsInfo->isNthPrevWordBeginningOfSentence(1 /* n */)
|
||||
? NOT_A_PROBABILITY : probability;
|
||||
const NgramProperty ngramProperty(wordCodePoints.toVector(), probabilityForNgram,
|
||||
historicalInfo);
|
||||
if (!addNgramEntry(prevWordsInfo, &ngramProperty)) {
|
||||
AKLOGE("Cannot update unigarm entry in updateCounter().");
|
||||
return false;
|
||||
|
|
|
@ -611,6 +611,7 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
|
|||
mCurrentTime);
|
||||
final NgramContext beginningOfSentenceContext = NgramContext.BEGINNING_OF_SENTENCE;
|
||||
onInputWordWithBeginningOfSentenceContext(binaryDictionary, "aaa", true /* isValidWord */);
|
||||
onInputWordWithBeginningOfSentenceContext(binaryDictionary, "aaa", true /* isValidWord */);
|
||||
assertTrue(binaryDictionary.isValidNgram(beginningOfSentenceContext, "aaa"));
|
||||
onInputWordWithBeginningOfSentenceContext(binaryDictionary, "aaa", true /* isValidWord */);
|
||||
onInputWordWithBeginningOfSentenceContext(binaryDictionary, "bbb", true /* isValidWord */);
|
||||
|
@ -622,6 +623,8 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
|
|||
assertFalse(binaryDictionary.isValidNgram(beginningOfSentenceContext, "bbb"));
|
||||
|
||||
onInputWordWithBeginningOfSentenceContext(binaryDictionary, "aaa", true /* isValidWord */);
|
||||
onInputWordWithBeginningOfSentenceContext(binaryDictionary, "aaa", true /* isValidWord */);
|
||||
onInputWordWithBeginningOfSentenceContext(binaryDictionary, "bbb", true /* isValidWord */);
|
||||
onInputWordWithBeginningOfSentenceContext(binaryDictionary, "bbb", true /* isValidWord */);
|
||||
assertTrue(binaryDictionary.isValidNgram(beginningOfSentenceContext, "aaa"));
|
||||
assertTrue(binaryDictionary.isValidNgram(beginningOfSentenceContext, "bbb"));
|
||||
|
|
Loading…
Reference in New Issue