diff options
author | 2012-06-28 16:41:00 +0900 | |
---|---|---|
committer | 2012-06-29 15:12:51 +0900 | |
commit | 1333579b4b4f392c73409b9a3fbfb428a0f8a9ed (patch) | |
tree | 0f6a7e79d31b02e2ae38f71ed637b946c12100e7 /java/src | |
parent | d426941ee8fd3f0bed5b26cbcf3780169054574d (diff) | |
download | latinime-1333579b4b4f392c73409b9a3fbfb428a0f8a9ed.tar.gz latinime-1333579b4b4f392c73409b9a3fbfb428a0f8a9ed.tar.xz latinime-1333579b4b4f392c73409b9a3fbfb428a0f8a9ed.zip |
Don't special-case 1-letter words (A13)
There is no reason to prevent 1-letter words to auto-correct
to themselves, or to dictionary words. Don't do it.
Change-Id: Iceada847ae632336026ada29afed0353cd9c51b5
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/AutoCorrection.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/AutoCorrection.java b/java/src/com/android/inputmethod/latin/AutoCorrection.java index 3699938c2..4ae12145c 100644 --- a/java/src/com/android/inputmethod/latin/AutoCorrection.java +++ b/java/src/com/android/inputmethod/latin/AutoCorrection.java @@ -38,9 +38,9 @@ public class AutoCorrection { final CharSequence whitelistedWord) { if (hasAutoCorrectionForWhitelistedWord(whitelistedWord)) { return whitelistedWord; - } else if (shouldAutoCorrectToSelf(dictionaries, wordComposer, consideredWord)) { + } else if (shouldAutoCorrectToSelf(dictionaries, consideredWord)) { return consideredWord; - } else if (hasAutoCorrectionForBinaryDictionary(wordComposer, suggestion, + } else if (hasAutoCorrectionForBinaryDictionary(suggestion, consideredWord, autoCorrectionThreshold)) { return suggestion.mWord; } @@ -110,16 +110,14 @@ public class AutoCorrection { private static boolean shouldAutoCorrectToSelf( final ConcurrentHashMap<String, Dictionary> dictionaries, - final WordComposer wordComposer, final CharSequence consideredWord) { + final CharSequence consideredWord) { if (TextUtils.isEmpty(consideredWord)) return false; - return wordComposer.size() > 1 - && !allowsToBeAutoCorrected(dictionaries, consideredWord, false); + return !allowsToBeAutoCorrected(dictionaries, consideredWord, false); } - private static boolean hasAutoCorrectionForBinaryDictionary(WordComposer wordComposer, - SuggestedWordInfo suggestion, + private static boolean hasAutoCorrectionForBinaryDictionary(SuggestedWordInfo suggestion, CharSequence consideredWord, float autoCorrectionThreshold) { - if (wordComposer.size() > 1 && null != suggestion) { + if (null != suggestion) { //final int autoCorrectionSuggestionScore = sortedScores[0]; final int autoCorrectionSuggestionScore = suggestion.mScore; // TODO: when the normalized score of the first suggestion is nearly equals to |