Loading java/src/com/android/inputmethod/latin/LatinIME.java +9 −5 Original line number Diff line number Diff line Loading @@ -2034,12 +2034,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar return; } final SuggestedWords.Builder builder; if (mCorrectionMode == Suggest.CORRECTION_FULL_BIGRAM) { final CharSequence prevWord = EditingUtils.getThisWord(getCurrentInputConnection(), mSettingsValues.mWordSeparators); SuggestedWords.Builder builder = mSuggest.getBigramPredictionWordBuilder(prevWord, mCorrectionMode); builder = mSuggest.getBigramPredictionWordBuilder(prevWord); } else { builder = null; } if (builder.size() > 0) { if (null == builder || builder.size() > 0) { // Explicitly supply an empty typed word (the no-second-arg version of // showSuggestions will retrieve the word near the cursor, we don't want that here) showSuggestions(builder.build(), ""); Loading java/src/com/android/inputmethod/latin/Suggest.java +17 −21 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -274,13 +273,11 @@ 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); // 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)) { Loading @@ -295,7 +292,6 @@ public class Suggest implements Dictionary.WordCallback { addBigramToSuggestions(mBigramSuggestions.get(i)); } } } StringUtils.removeDupes(mSuggestions); Loading Loading
java/src/com/android/inputmethod/latin/LatinIME.java +9 −5 Original line number Diff line number Diff line Loading @@ -2034,12 +2034,16 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar return; } final SuggestedWords.Builder builder; if (mCorrectionMode == Suggest.CORRECTION_FULL_BIGRAM) { final CharSequence prevWord = EditingUtils.getThisWord(getCurrentInputConnection(), mSettingsValues.mWordSeparators); SuggestedWords.Builder builder = mSuggest.getBigramPredictionWordBuilder(prevWord, mCorrectionMode); builder = mSuggest.getBigramPredictionWordBuilder(prevWord); } else { builder = null; } if (builder.size() > 0) { if (null == builder || builder.size() > 0) { // Explicitly supply an empty typed word (the no-second-arg version of // showSuggestions will retrieve the word near the cursor, we don't want that here) showSuggestions(builder.build(), ""); Loading
java/src/com/android/inputmethod/latin/Suggest.java +17 −21 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -274,13 +273,11 @@ 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); // 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)) { Loading @@ -295,7 +292,6 @@ public class Suggest implements Dictionary.WordCallback { addBigramToSuggestions(mBigramSuggestions.get(i)); } } } StringUtils.removeDupes(mSuggestions); Loading