Stop uselessly remembering a value (A2)
The value is only used in debug mode, and it can be recomputed at the time. This change does not impact the logic. There is however a side effect: in debug mode, the normalized score will be displayed also when the word comes out of the whitelist or is a valid word. It's actually a good thing. The end purpose is to make all methods in AutoCorrection static. Change-Id: I1642b1fdfa6ae62b8aa2fed94a8a26ff4a7e4d0emain
parent
ec0fca8a8b
commit
719f92fc77
|
@ -118,15 +118,15 @@ public class AutoCorrection {
|
||||||
final int autoCorrectionSuggestionScore = sortedScores[0];
|
final int autoCorrectionSuggestionScore = sortedScores[0];
|
||||||
// TODO: when the normalized score of the first suggestion is nearly equals to
|
// TODO: when the normalized score of the first suggestion is nearly equals to
|
||||||
// the normalized score of the second suggestion, behave less aggressive.
|
// the normalized score of the second suggestion, behave less aggressive.
|
||||||
mNormalizedScore = BinaryDictionary.calcNormalizedScore(
|
final double normalizedScore = BinaryDictionary.calcNormalizedScore(
|
||||||
typedWord.toString(), autoCorrectionSuggestion.toString(),
|
typedWord.toString(), autoCorrectionSuggestion.toString(),
|
||||||
autoCorrectionSuggestionScore);
|
autoCorrectionSuggestionScore);
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
Log.d(TAG, "Normalized " + typedWord + "," + autoCorrectionSuggestion + ","
|
Log.d(TAG, "Normalized " + typedWord + "," + autoCorrectionSuggestion + ","
|
||||||
+ autoCorrectionSuggestionScore + ", " + mNormalizedScore
|
+ autoCorrectionSuggestionScore + ", " + normalizedScore
|
||||||
+ "(" + autoCorrectionThreshold + ")");
|
+ "(" + autoCorrectionThreshold + ")");
|
||||||
}
|
}
|
||||||
if (mNormalizedScore >= autoCorrectionThreshold) {
|
if (normalizedScore >= autoCorrectionThreshold) {
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
Log.d(TAG, "Auto corrected by S-threshold.");
|
Log.d(TAG, "Auto corrected by S-threshold.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -386,7 +386,11 @@ public class Suggest implements Dictionary.WordCallback {
|
||||||
Utils.removeDupes(mSuggestions);
|
Utils.removeDupes(mSuggestions);
|
||||||
|
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
double normalizedScore = mAutoCorrection.getNormalizedScore();
|
final CharSequence autoCorrectionSuggestion = mSuggestions.get(0);
|
||||||
|
final int autoCorrectionSuggestionScore = mScores[0];
|
||||||
|
double normalizedScore = BinaryDictionary.calcNormalizedScore(
|
||||||
|
typedWord.toString(), autoCorrectionSuggestion.toString(),
|
||||||
|
autoCorrectionSuggestionScore);
|
||||||
ArrayList<SuggestedWords.SuggestedWordInfo> scoreInfoList =
|
ArrayList<SuggestedWords.SuggestedWordInfo> scoreInfoList =
|
||||||
new ArrayList<SuggestedWords.SuggestedWordInfo>();
|
new ArrayList<SuggestedWords.SuggestedWordInfo>();
|
||||||
scoreInfoList.add(new SuggestedWords.SuggestedWordInfo("+", false));
|
scoreInfoList.add(new SuggestedWords.SuggestedWordInfo("+", false));
|
||||||
|
|
Loading…
Reference in New Issue