aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod')
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
index 85c142f1e..ae47ab22b 100644
--- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
+++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java
@@ -160,6 +160,9 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
if (mLength != mSuggestions.size()) {
Log.e(TAG, "Suggestion size is not the same as stored mLength");
}
+ for (int i = mLength - 1; i >= 0; --i) {
+ Log.i(TAG, "" + mScores[i] + " " + mSuggestions.get(i));
+ }
}
Collections.reverse(mSuggestions);
Utils.removeDupes(mSuggestions);
@@ -167,11 +170,16 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
// into a String[].
gatheredSuggestions = mSuggestions.toArray(EMPTY_STRING_ARRAY);
- final int bestScore = mScores[0];
+ final int bestScore = mScores[mLength - 1];
final CharSequence bestSuggestion = mSuggestions.get(0);
final double normalizedScore =
Utils.calcNormalizedScore(originalText, bestSuggestion, bestScore);
looksLikeTypo = (normalizedScore > threshold);
+ if (DBG) {
+ Log.i(TAG, "Best suggestion : " + bestSuggestion + ", score " + bestScore);
+ Log.i(TAG, "Normalized score = " + normalizedScore + " (threshold " + threshold
+ + ") => looksLikeTypo = " + looksLikeTypo);
+ }
}
return new Result(gatheredSuggestions, looksLikeTypo);
}
@@ -305,6 +313,16 @@ public class AndroidSpellCheckerService extends SpellCheckerService {
final SuggestionsGatherer.Result result =
suggestionsGatherer.getResults(text, mService.mTypoThreshold);
+ if (DBG) {
+ Log.i(TAG, "Spell checking results for " + text + " with suggestion limit "
+ + suggestionsLimit);
+ Log.i(TAG, "IsInDict = " + result.mLooksLikeTypo);
+ Log.i(TAG, "LooksLikeTypo = " + result.mLooksLikeTypo);
+ for (String suggestion : result.mSuggestions) {
+ Log.i(TAG, suggestion);
+ }
+ }
+
final int flags =
(isInDict ? SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY : 0)
| (result.mLooksLikeTypo