mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Merge "Fix: BoS prediction is shown after inputting just once."
This commit is contained in:
commit
c7d199e770
@ -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
Block a user