diff options
author | 2013-01-15 13:48:15 -0800 | |
---|---|---|
committer | 2013-01-22 11:41:52 -0800 | |
commit | 0c16a5c6eef645fd536671994e0b4f05864ac338 (patch) | |
tree | 55cf1d2987a6481b07b4f332c87384aa219f0a8d /java/src/com/android/inputmethod/research/ResearchLogger.java | |
parent | 8b788374dee56dfe95e7af42a358923cfcb3668e (diff) | |
download | latinime-0c16a5c6eef645fd536671994e0b4f05864ac338.tar.gz latinime-0c16a5c6eef645fd536671994e0b4f05864ac338.tar.xz latinime-0c16a5c6eef645fd536671994e0b4f05864ac338.zip |
[Rlog81a] Determine correction type of words
Heuristic to determine whether a word was a typo correction or a complete
replacement by examining a correction to see if it falls within the list of
suggested words of the original.
Change-Id: Ieec4861a811e96aef0d14622e662b589ef8b4772
Diffstat (limited to 'java/src/com/android/inputmethod/research/ResearchLogger.java')
-rw-r--r-- | java/src/com/android/inputmethod/research/ResearchLogger.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java index 0a24af6d5..29bc70880 100644 --- a/java/src/com/android/inputmethod/research/ResearchLogger.java +++ b/java/src/com/android/inputmethod/research/ResearchLogger.java @@ -745,6 +745,10 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang mCurrentLogUnit.setContainsCorrection(); } + private void setCurrentLogUnitCorrectionType(final int correctionType) { + mCurrentLogUnit.setCorrectionType(correctionType); + } + /* package for test */ void commitCurrentLogUnit() { if (DEBUG) { Log.d(TAG, "commitCurrentLogUnit" + (mCurrentLogUnit.hasWord() ? @@ -1194,13 +1198,17 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang "suggestion", "x", "y"); public static void latinIME_pickSuggestionManually(final String replacedWord, final int index, final String suggestion, final boolean isBatchMode) { - final String scrubbedWord = scrubDigitsFromString(suggestion); final ResearchLogger researchLogger = getInstance(); + if (!replacedWord.equals(suggestion.toString())) { + // The user choose something other than what was already there. + researchLogger.setCurrentLogUnitContainsCorrection(); + researchLogger.setCurrentLogUnitCorrectionType(LogUnit.CORRECTIONTYPE_TYPO); + } + final String scrubbedWord = scrubDigitsFromString(suggestion); researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_PICKSUGGESTIONMANUALLY, scrubDigitsFromString(replacedWord), index, suggestion == null ? null : scrubbedWord, Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE); - researchLogger.setCurrentLogUnitContainsCorrection(); researchLogger.commitCurrentLogUnitAsWord(scrubbedWord, Long.MAX_VALUE, isBatchMode); researchLogger.mStatistics.recordManualSuggestion(SystemClock.uptimeMillis()); } @@ -1490,10 +1498,12 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang new LogStatement("LatinIMECommitCurrentAutoCorrection", true, true, "typedWord", "autoCorrection", "separatorString"); public static void latinIme_commitCurrentAutoCorrection(final String typedWord, - final String autoCorrection, final String separatorString, final boolean isBatchMode) { + final String autoCorrection, final String separatorString, final boolean isBatchMode, + final SuggestedWords suggestedWords) { final String scrubbedTypedWord = scrubDigitsFromString(typedWord); final String scrubbedAutoCorrection = scrubDigitsFromString(autoCorrection); final ResearchLogger researchLogger = getInstance(); + researchLogger.mCurrentLogUnit.initializeSuggestions(suggestedWords); researchLogger.commitCurrentLogUnitAsWord(scrubbedAutoCorrection, Long.MAX_VALUE, isBatchMode); @@ -1691,10 +1701,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang new LogStatement("LatinIMEOnEndBatchInput", true, false, "enteredText", "enteredWordPos"); public static void latinIME_onEndBatchInput(final CharSequence enteredText, - final int enteredWordPos) { + final int enteredWordPos, final SuggestedWords suggestedWords) { final ResearchLogger researchLogger = getInstance(); researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_ONENDBATCHINPUT, enteredText, enteredWordPos); + researchLogger.mCurrentLogUnit.initializeSuggestions(suggestedWords); researchLogger.mStatistics.recordGestureInput(enteredText.length(), SystemClock.uptimeMillis()); } |