Loading java/src/com/android/inputmethod/latin/AutoCorrection.java +2 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,8 @@ public class AutoCorrection { public static boolean suggestionExceedsAutoCorrectionThreshold(SuggestedWordInfo suggestion, CharSequence consideredWord, float autoCorrectionThreshold) { if (null != suggestion) { //final int autoCorrectionSuggestionScore = sortedScores[0]; // Shortlist a whitelisted word if (suggestion.mKind == SuggestedWordInfo.KIND_WHITELIST) return true; final int autoCorrectionSuggestionScore = suggestion.mScore; // TODO: when the normalized score of the first suggestion is nearly equals to // the normalized score of the second suggestion, behave less aggressive. Loading java/src/com/android/inputmethod/latin/Suggest.java +6 −8 Original line number Diff line number Diff line Loading @@ -205,6 +205,12 @@ public class Suggest { final CharSequence whitelistedWord = mWhiteListDictionary.getWhitelistedWord(consideredWord); if (whitelistedWord != null) { // MAX_SCORE ensures this will be considered strong enough to be auto-corrected suggestionsSet.add(new SuggestedWordInfo(whitelistedWord, SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_WHITELIST, Dictionary.TYPE_WHITELIST)); } final boolean hasAutoCorrection; // TODO: using isCorrectionEnabled here is not very good. It's probably useless, because Loading @@ -222,8 +228,6 @@ public class Suggest { // would always auto-correct to "Will" which is unwanted. Hence, no main dict => no // auto-correct. hasAutoCorrection = false; } else if (null != whitelistedWord) { hasAutoCorrection = true; } else if (suggestionsSet.isEmpty()) { hasAutoCorrection = false; } else if (AutoCorrection.suggestionExceedsAutoCorrectionThreshold(suggestionsSet.first(), Loading @@ -233,12 +237,6 @@ public class Suggest { hasAutoCorrection = false; } if (whitelistedWord != null) { suggestionsSet.add(new SuggestedWordInfo(whitelistedWord, SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_WHITELIST, Dictionary.TYPE_WHITELIST)); } final ArrayList<SuggestedWordInfo> suggestionsContainer = new ArrayList<SuggestedWordInfo>(suggestionsSet); final int suggestionsCount = suggestionsContainer.size(); Loading Loading
java/src/com/android/inputmethod/latin/AutoCorrection.java +2 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,8 @@ public class AutoCorrection { public static boolean suggestionExceedsAutoCorrectionThreshold(SuggestedWordInfo suggestion, CharSequence consideredWord, float autoCorrectionThreshold) { if (null != suggestion) { //final int autoCorrectionSuggestionScore = sortedScores[0]; // Shortlist a whitelisted word if (suggestion.mKind == SuggestedWordInfo.KIND_WHITELIST) return true; final int autoCorrectionSuggestionScore = suggestion.mScore; // TODO: when the normalized score of the first suggestion is nearly equals to // the normalized score of the second suggestion, behave less aggressive. Loading
java/src/com/android/inputmethod/latin/Suggest.java +6 −8 Original line number Diff line number Diff line Loading @@ -205,6 +205,12 @@ public class Suggest { final CharSequence whitelistedWord = mWhiteListDictionary.getWhitelistedWord(consideredWord); if (whitelistedWord != null) { // MAX_SCORE ensures this will be considered strong enough to be auto-corrected suggestionsSet.add(new SuggestedWordInfo(whitelistedWord, SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_WHITELIST, Dictionary.TYPE_WHITELIST)); } final boolean hasAutoCorrection; // TODO: using isCorrectionEnabled here is not very good. It's probably useless, because Loading @@ -222,8 +228,6 @@ public class Suggest { // would always auto-correct to "Will" which is unwanted. Hence, no main dict => no // auto-correct. hasAutoCorrection = false; } else if (null != whitelistedWord) { hasAutoCorrection = true; } else if (suggestionsSet.isEmpty()) { hasAutoCorrection = false; } else if (AutoCorrection.suggestionExceedsAutoCorrectionThreshold(suggestionsSet.first(), Loading @@ -233,12 +237,6 @@ public class Suggest { hasAutoCorrection = false; } if (whitelistedWord != null) { suggestionsSet.add(new SuggestedWordInfo(whitelistedWord, SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_WHITELIST, Dictionary.TYPE_WHITELIST)); } final ArrayList<SuggestedWordInfo> suggestionsContainer = new ArrayList<SuggestedWordInfo>(suggestionsSet); final int suggestionsCount = suggestionsContainer.size(); Loading