aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2014-06-16 09:25:33 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-06-16 09:25:33 +0000
commitff6e967b48880665e2a0830b4918888c3b931d74 (patch)
treeec84c1ae2682e4d7ace982898b504b9a9179642c /java/src/com/android/inputmethod
parent7edd957e709407f90045c5c1f4674cf13f27d0c1 (diff)
parentcb368a6dac1d3148785da4fd8572bb79847c2ad1 (diff)
downloadlatinime-ff6e967b48880665e2a0830b4918888c3b931d74.tar.gz
latinime-ff6e967b48880665e2a0830b4918888c3b931d74.tar.xz
latinime-ff6e967b48880665e2a0830b4918888c3b931d74.zip
am cb368a6d: Fix: Probability used for one word contextual phrase.
* commit 'cb368a6dac1d3148785da4fd8572bb79847c2ad1': Fix: Probability used for one word contextual phrase.
Diffstat (limited to 'java/src/com/android/inputmethod')
-rw-r--r--java/src/com/android/inputmethod/latin/DictionaryFacilitator.java29
1 files changed, 14 insertions, 15 deletions
diff --git a/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java b/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java
index f5ad79222..4a28a242a 100644
--- a/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java
+++ b/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java
@@ -622,28 +622,27 @@ public class DictionaryFacilitator {
}
PrevWordsInfo prevWordsInfo = PrevWordsInfo.BEGINNING_OF_SENTENCE;
for (int i = 0; i < phrase.length; i++) {
+ final String[] subPhrase = Arrays.copyOfRange(phrase, i /* start */, phrase.length);
+ final String subPhraseStr = TextUtils.join(Constants.WORD_SEPARATOR, subPhrase);
+ contextualDict.addUnigramEntryWithCheckingDistracter(
+ subPhraseStr, probability, null /* shortcutTarget */,
+ Dictionary.NOT_A_PROBABILITY /* shortcutFreq */,
+ false /* isNotAWord */, false /* isBlacklisted */,
+ BinaryDictionary.NOT_A_VALID_TIMESTAMP,
+ DistracterFilter.EMPTY_DISTRACTER_FILTER);
+ contextualDict.addNgramEntry(prevWordsInfo, subPhraseStr,
+ bigramProbabilityForPhrases, BinaryDictionary.NOT_A_VALID_TIMESTAMP);
+
if (i < phrase.length - 1) {
- final String[] subPhrase =
- Arrays.copyOfRange(phrase, i /* start */, phrase.length);
- final String subPhraseStr = TextUtils.join(Constants.WORD_SEPARATOR, subPhrase);
contextualDict.addUnigramEntryWithCheckingDistracter(
- subPhraseStr, probability, null /* shortcutTarget */,
+ phrase[i], probability, null /* shortcutTarget */,
Dictionary.NOT_A_PROBABILITY /* shortcutFreq */,
false /* isNotAWord */, false /* isBlacklisted */,
BinaryDictionary.NOT_A_VALID_TIMESTAMP,
DistracterFilter.EMPTY_DISTRACTER_FILTER);
- contextualDict.addNgramEntry(prevWordsInfo, subPhraseStr,
- bigramProbabilityForPhrases, BinaryDictionary.NOT_A_VALID_TIMESTAMP);
-
+ contextualDict.addNgramEntry(prevWordsInfo, phrase[i],
+ bigramProbabilityForWords, BinaryDictionary.NOT_A_VALID_TIMESTAMP);
}
- contextualDict.addUnigramEntryWithCheckingDistracter(
- phrase[i], probability, null /* shortcutTarget */,
- Dictionary.NOT_A_PROBABILITY /* shortcutFreq */,
- false /* isNotAWord */, false /* isBlacklisted */,
- BinaryDictionary.NOT_A_VALID_TIMESTAMP,
- DistracterFilter.EMPTY_DISTRACTER_FILTER);
- contextualDict.addNgramEntry(prevWordsInfo, phrase[i],
- bigramProbabilityForWords, BinaryDictionary.NOT_A_VALID_TIMESTAMP);
prevWordsInfo = new PrevWordsInfo(phrase[i]);
}
}