Merge "Fix: deleted PtNode handling in v403."
This commit is contained in:
commit
23e07c971b
2 changed files with 9 additions and 1 deletions
|
@ -97,6 +97,9 @@ int Ver4PatriciaTriePolicy::getWordId(const CodePointArrayView wordCodePoints,
|
||||||
return NOT_A_WORD_ID;
|
return NOT_A_WORD_ID;
|
||||||
}
|
}
|
||||||
const PtNodeParams ptNodeParams = mNodeReader.fetchPtNodeParamsInBufferFromPtNodePos(ptNodePos);
|
const PtNodeParams ptNodeParams = mNodeReader.fetchPtNodeParamsInBufferFromPtNodePos(ptNodePos);
|
||||||
|
if (ptNodeParams.isDeleted()) {
|
||||||
|
return NOT_A_WORD_ID;
|
||||||
|
}
|
||||||
return ptNodeParams.getTerminalId();
|
return ptNodeParams.getTerminalId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -746,7 +746,12 @@ public class BinaryDictionaryDecayingTests extends AndroidTestCase {
|
||||||
assertTrue(binaryDictionary.isValidWord("aaa"));
|
assertTrue(binaryDictionary.isValidWord("aaa"));
|
||||||
assertTrue(binaryDictionary.removeUnigramEntry("aaa"));
|
assertTrue(binaryDictionary.removeUnigramEntry("aaa"));
|
||||||
assertFalse(binaryDictionary.isValidWord("aaa"));
|
assertFalse(binaryDictionary.isValidWord("aaa"));
|
||||||
|
onInputWord(binaryDictionary, "aaa", false /* isValidWord */);
|
||||||
|
assertFalse(binaryDictionary.isValidWord("aaa"));
|
||||||
|
onInputWord(binaryDictionary, "aaa", false /* isValidWord */);
|
||||||
|
assertTrue(binaryDictionary.isValidWord("aaa"));
|
||||||
|
assertTrue(binaryDictionary.removeUnigramEntry("aaa"));
|
||||||
|
assertFalse(binaryDictionary.isValidWord("aaa"));
|
||||||
binaryDictionary.close();
|
binaryDictionary.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue