diff options
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Suggest.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index b050c3e90..ccbb84f35 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -18,7 +18,6 @@ package com.android.inputmethod.latin; import android.content.Context; import android.text.TextUtils; -import android.util.Log; import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.ProximityInfo; @@ -58,8 +57,6 @@ public class Suggest { // Locale used for upper- and title-casing words final private Locale mLocale; - private static final int MINIMUM_SAFETY_NET_CHAR_LENGTH = 4; - public Suggest(final Context context, final Locale locale) { initAsynchronously(context, locale); mLocale = locale; @@ -244,7 +241,7 @@ public class Suggest { hasAutoCorrection = false; } else if (AutoCorrection.suggestionExceedsAutoCorrectionThreshold(suggestionsSet.first(), consideredWord, mAutoCorrectionThreshold)) { - hasAutoCorrection = !shouldBlockAutoCorrectionBySafetyNet(typedWord, + hasAutoCorrection = !AutoCorrection.shouldBlockAutoCorrectionBySafetyNet(typedWord, suggestionsSet.first().mWord); } else { hasAutoCorrection = false; @@ -365,37 +362,4 @@ public class Suggest { } mMainDictionary = null; } - - // TODO: Resolve the inconsistencies between the native auto correction algorithms and - // this safety net - public static boolean shouldBlockAutoCorrectionBySafetyNet(final String typedWord, - final CharSequence suggestion) { - // Safety net for auto correction. - // Actually if we hit this safety net, it's a bug. - // If user selected aggressive auto correction mode, there is no need to use the safety - // net. - // If the length of typed word is less than MINIMUM_SAFETY_NET_CHAR_LENGTH, - // we should not use net because relatively edit distance can be big. - final int typedWordLength = typedWord.length(); - if (typedWordLength < Suggest.MINIMUM_SAFETY_NET_CHAR_LENGTH) { - return false; - } - final int maxEditDistanceOfNativeDictionary = - (typedWordLength < 5 ? 2 : typedWordLength / 2) + 1; - final int distance = BinaryDictionary.editDistance(typedWord, suggestion.toString()); - if (DBG) { - Log.d(TAG, "Autocorrected edit distance = " + distance - + ", " + maxEditDistanceOfNativeDictionary); - } - if (distance > maxEditDistanceOfNativeDictionary) { - if (DBG) { - Log.e(TAG, "Safety net: before = " + typedWord + ", after = " + suggestion); - Log.e(TAG, "(Error) The edit distance of this correction exceeds limit. " - + "Turning off auto-correction."); - } - return true; - } else { - return false; - } - } } |