diff options
author | 2012-03-15 12:23:16 +0900 | |
---|---|---|
committer | 2012-03-15 12:23:16 +0900 | |
commit | ca3e7cbdf43baf8f70d8f71d04de5b1b09345461 (patch) | |
tree | 721428a54e639c40e3d8694102d6033792e866bf /java/src/com/android/inputmethod/latin/Suggest.java | |
parent | eb5ffdac900ac2976004e8d063c9536baaad759d (diff) | |
download | latinime-ca3e7cbdf43baf8f70d8f71d04de5b1b09345461.tar.gz latinime-ca3e7cbdf43baf8f70d8f71d04de5b1b09345461.tar.xz latinime-ca3e7cbdf43baf8f70d8f71d04de5b1b09345461.zip |
Move a computation closer to where it's used.
Change-Id: I5aee4c36ceaacbb1dbfc47c011f1e4aec4b9dca6
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Suggest.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 277cc4040..c0ec4f614 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -296,14 +296,6 @@ public class Suggest implements Dictionary.WordCallback { LatinImeLogger.onAddSuggestedWord(typedWord, Suggest.DIC_USER_TYPED, Dictionary.UNIGRAM); mConsideredWord = consideredWord; - // TODO: Change this scheme - a boolean is not enough. A whitelisted word may be "valid" - // but still autocorrected from - in the case the whitelist only capitalizes the word. - // The whitelist should be case-insensitive, so it's not possible to be consistent with - // a boolean flag. Right now this is handled with a slight hack in - // WhitelistDictionary#shouldForciblyAutoCorrectFrom. - final boolean allowsToBeAutoCorrected = AutoCorrection.allowsToBeAutoCorrected( - getUnigramDictionaries(), consideredWord, wordComposer.isFirstCharCapitalized()); - if (wordComposer.size() <= 1 && (correctionMode == CORRECTION_FULL_BIGRAM)) { // At first character typed, search only the bigrams Arrays.fill(mBigramScores, 0); @@ -398,6 +390,14 @@ public class Suggest implements Dictionary.WordCallback { suggestionsList = SuggestedWords.getFromCharSequenceList(mSuggestions); } + // TODO: Change this scheme - a boolean is not enough. A whitelisted word may be "valid" + // but still autocorrected from - in the case the whitelist only capitalizes the word. + // The whitelist should be case-insensitive, so it's not possible to be consistent with + // a boolean flag. Right now this is handled with a slight hack in + // WhitelistDictionary#shouldForciblyAutoCorrectFrom. + final boolean allowsToBeAutoCorrected = AutoCorrection.allowsToBeAutoCorrected( + getUnigramDictionaries(), consideredWord, wordComposer.isFirstCharCapitalized()); + boolean autoCorrectionAvailable = hasAutoCorrection; if (correctionMode == CORRECTION_FULL || correctionMode == CORRECTION_FULL_BIGRAM) { autoCorrectionAvailable |= !allowsToBeAutoCorrected; |