Consolidate a method inside another (A45)

It's simpler to check the safety net directly inside the
function that checks for auto-correction threshold.

This introduces one very slight change in behavior. The value
checked by the safety net is not any more the "typed word" but the
"considered word", the difference being any possibly appended
single quotes.
E.g. the user types "this'''" : the typed word is "this'''" but
the considered word is "this".
This change in behavior can be considered a bugfix.

Change-Id: Ia7ab4bc933183dfbd41bb00328e4c0b5ab76bc63
main
Jean Chalard 2012-06-28 20:34:06 +09:00
parent f72b8f5662
commit c5e911c06b
2 changed files with 3 additions and 3 deletions

View File

@ -108,7 +108,8 @@ public class AutoCorrection {
if (DBG) {
Log.d(TAG, "Auto corrected by S-threshold.");
}
return true;
return !shouldBlockAutoCorrectionBySafetyNet(consideredWord.toString(),
suggestion.mWord);
}
}
return false;

View File

@ -241,8 +241,7 @@ public class Suggest {
hasAutoCorrection = false;
} else if (AutoCorrection.suggestionExceedsAutoCorrectionThreshold(suggestionsSet.first(),
consideredWord, mAutoCorrectionThreshold)) {
hasAutoCorrection = !AutoCorrection.shouldBlockAutoCorrectionBySafetyNet(typedWord,
suggestionsSet.first().mWord);
hasAutoCorrection = true;
} else {
hasAutoCorrection = false;
}