diff options
author | 2014-02-06 05:03:15 -0800 | |
---|---|---|
committer | 2014-02-06 05:03:15 -0800 | |
commit | 4f3f048872d2c00124de61c9a0381afb374e3ddb (patch) | |
tree | 89a815dee76a118db84233e2b588e2ec8c62f9da /java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java | |
parent | 0267be43fb27200881fadf02548cca50a3279e1c (diff) | |
parent | 6422f77e9497120fe6b2d7ec012c214c06829bab (diff) | |
download | latinime-4f3f048872d2c00124de61c9a0381afb374e3ddb.tar.gz latinime-4f3f048872d2c00124de61c9a0381afb374e3ddb.tar.xz latinime-4f3f048872d2c00124de61c9a0381afb374e3ddb.zip |
am 6422f77e: Merge "Use native logic to read Ver4 dict."
* commit '6422f77e9497120fe6b2d7ec012c214c06829bab':
Use native logic to read Ver4 dict.
Diffstat (limited to 'java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java b/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java index e9561afd3..ca4a2e9bb 100644 --- a/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java +++ b/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java @@ -436,25 +436,25 @@ public final class FusionDictionary implements Iterable<WordProperty> { /** * Helper method to add a new bigram to the dictionary. * - * @param word1 the previous word of the context - * @param word2 the next word of the context + * @param word0 the previous word of the context + * @param word1 the next word of the context * @param frequency the bigram frequency */ - public void setBigram(final String word1, final String word2, final int frequency) { - PtNode ptNode = findWordInTree(mRootNodeArray, word1); - if (ptNode != null) { - final PtNode ptNode2 = findWordInTree(mRootNodeArray, word2); - if (ptNode2 == null) { - add(getCodePoints(word2), 0, null, false /* isNotAWord */, + public void setBigram(final String word0, final String word1, final int frequency) { + PtNode ptNode0 = findWordInTree(mRootNodeArray, word0); + if (ptNode0 != null) { + final PtNode ptNode1 = findWordInTree(mRootNodeArray, word1); + if (ptNode1 == null) { + add(getCodePoints(word1), 0, null, false /* isNotAWord */, false /* isBlacklistEntry */); // The PtNode for the first word may have moved by the above insertion, // if word1 and word2 share a common stem that happens not to have been // a cutting point until now. In this case, we need to refresh ptNode. - ptNode = findWordInTree(mRootNodeArray, word1); + ptNode0 = findWordInTree(mRootNodeArray, word0); } - ptNode.addBigram(word2, frequency); + ptNode0.addBigram(word1, frequency); } else { - throw new RuntimeException("First word of bigram not found"); + throw new RuntimeException("First word of bigram not found " + word0); } } |