diff options
author | 2012-03-09 18:24:41 +0900 | |
---|---|---|
committer | 2012-03-09 18:59:20 +0900 | |
commit | a333ff19ef330c93287cfa0f6568d0cdcd431b04 (patch) | |
tree | 311e88c68afae422f1355d163412045dfb3ee2f2 /java/src/com/android/inputmethod/latin/Suggest.java | |
parent | a3ee019331e2d8881e19185fba9ccebfeb170614 (diff) | |
download | latinime-a333ff19ef330c93287cfa0f6568d0cdcd431b04.tar.gz latinime-a333ff19ef330c93287cfa0f6568d0cdcd431b04.tar.xz latinime-a333ff19ef330c93287cfa0f6568d0cdcd431b04.zip |
Reduction, step 7
Change-Id: I177ef2f29c8b6000c5e3d021c016c5d216fe3fc6
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Suggest.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 11501612e..b8ec5ff9d 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -261,8 +261,7 @@ public class Suggest implements Dictionary.WordCallback { } private static final WordComposer sEmptyWordComposer = new WordComposer(); - public SuggestedWords.Builder getBigramPredictionWordBuilder(CharSequence prevWordForBigram, - final int correctionMode) { + public SuggestedWords.Builder getBigramPredictionWordBuilder(CharSequence prevWordForBigram) { LatinImeLogger.onStartSuggestion(prevWordForBigram); mIsFirstCharCapitalized = false; mIsAllUpperCase = false; @@ -274,26 +273,23 @@ public class Suggest implements Dictionary.WordCallback { LatinImeLogger.onAddSuggestedWord("", Suggest.DIC_USER_TYPED, Dictionary.UNIGRAM); mConsideredWord = ""; - // Note that if correctionMode != CORRECTION_FULL_BIGRAM, we'll always return the - // same empty SuggestedWords.Builder, which has size() == 0 - if (correctionMode == CORRECTION_FULL_BIGRAM) { - // At first character typed, search only the bigrams - Arrays.fill(mBigramScores, 0); - collectGarbage(mBigramSuggestions, PREF_MAX_BIGRAMS); + Arrays.fill(mBigramScores, 0); + collectGarbage(mBigramSuggestions, PREF_MAX_BIGRAMS); - if (!TextUtils.isEmpty(prevWordForBigram)) { - CharSequence lowerPrevWord = prevWordForBigram.toString().toLowerCase(); - if (mMainDict != null && mMainDict.isValidWord(lowerPrevWord)) { - prevWordForBigram = lowerPrevWord; - } - for (final Dictionary dictionary : mBigramDictionaries.values()) { - dictionary.getBigrams(sEmptyWordComposer, prevWordForBigram, this); - } - // Nothing entered: return all bigrams for the previous word - int insertCount = Math.min(mBigramSuggestions.size(), mPrefMaxSuggestions); - for (int i = 0; i < insertCount; ++i) { - addBigramToSuggestions(mBigramSuggestions.get(i)); - } + // Note that if prevWordForBigram is empty, we'll always return the same empty + // SuggestedWords.Builder + if (!TextUtils.isEmpty(prevWordForBigram)) { + CharSequence lowerPrevWord = prevWordForBigram.toString().toLowerCase(); + if (mMainDict != null && mMainDict.isValidWord(lowerPrevWord)) { + prevWordForBigram = lowerPrevWord; + } + for (final Dictionary dictionary : mBigramDictionaries.values()) { + dictionary.getBigrams(sEmptyWordComposer, prevWordForBigram, this); + } + // Nothing entered: return all bigrams for the previous word + int insertCount = Math.min(mBigramSuggestions.size(), mPrefMaxSuggestions); + for (int i = 0; i < insertCount; ++i) { + addBigramToSuggestions(mBigramSuggestions.get(i)); } } |