aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/Suggest.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-03-09 17:31:53 +0900
committerJean Chalard <jchalard@google.com>2012-03-09 18:36:45 +0900
commitdf9fce5df1bacdffb39c7926bdda4b205f186998 (patch)
tree7dd141bb1b70b88380b6b6110589b5c6b2add49d /java/src/com/android/inputmethod/latin/Suggest.java
parent0cb7b007047b9e7fadcb6024ecc547cf475ceca9 (diff)
downloadlatinime-df9fce5df1bacdffb39c7926bdda4b205f186998.tar.gz
latinime-df9fce5df1bacdffb39c7926bdda4b205f186998.tar.xz
latinime-df9fce5df1bacdffb39c7926bdda4b205f186998.zip
Export some logic out of LatinIME
Hopefully that will end in Suggest/SuggestedWords being autonomous and won't need the logic spoon-fed to them Change-Id: I915661bce13c69c8a5b8e5d4a8c41e18fea594cf
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Suggest.java')
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index b6a7ce74a..4773ac55a 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -282,6 +282,14 @@ public class Suggest implements Dictionary.WordCallback {
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);
@@ -393,9 +401,11 @@ public class Suggest implements Dictionary.WordCallback {
for (int i = mScores.length; i < mSuggestions.size(); ++i) {
scoreInfoList.add(new SuggestedWords.SuggestedWordInfo("--", false));
}
- return new SuggestedWords.Builder().addWords(mSuggestions, scoreInfoList);
+ return new SuggestedWords.Builder().addWords(mSuggestions, scoreInfoList)
+ .setAllowsToBeAutoCorrected(allowsToBeAutoCorrected);
}
- return new SuggestedWords.Builder().addWords(mSuggestions, null);
+ return new SuggestedWords.Builder().addWords(mSuggestions, null)
+ .setAllowsToBeAutoCorrected(allowsToBeAutoCorrected);
}
public boolean hasAutoCorrection() {