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
main
Jean Chalard 2012-06-28 16:41:00 +09:00
parent d426941ee8
commit 1333579b4b
1 changed files with 6 additions and 8 deletions

View File

@ -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