From fc98325c61e5df3845f3d2b4906b0af301204b73 Mon Sep 17 00:00:00 2001 From: Kurt Partridge Date: Thu, 13 Jun 2013 10:17:47 -0700 Subject: [PATCH] Log score, kind, and sourceDict for manual suggestion and gesture b/9422713 Change-Id: I4880fad6a5b10d09ca11b63311f14862bee724e5 --- java/src/com/android/inputmethod/latin/LatinIME.java | 3 ++- .../com/android/inputmethod/research/JsonUtils.java | 9 +++++++-- .../android/inputmethod/research/ResearchLogger.java | 11 ++++++----- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 6a3066cc1..73ec57871 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -2357,7 +2357,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen LastComposedWord.NOT_A_SEPARATOR); if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { ResearchLogger.latinIME_pickSuggestionManually(replacedWord, index, suggestion, - mWordComposer.isBatchMode()); + mWordComposer.isBatchMode(), suggestionInfo.mScore, suggestionInfo.mKind, + suggestionInfo.mSourceDict); } mConnection.endBatchEdit(); // Don't allow cancellation of manual pick diff --git a/java/src/com/android/inputmethod/research/JsonUtils.java b/java/src/com/android/inputmethod/research/JsonUtils.java index 24cd8d935..63d524df7 100644 --- a/java/src/com/android/inputmethod/research/JsonUtils.java +++ b/java/src/com/android/inputmethod/research/JsonUtils.java @@ -94,12 +94,17 @@ import java.util.Map; .value(words.mIsPunctuationSuggestions); jsonWriter.name("isObsoleteSuggestions").value(words.mIsObsoleteSuggestions); jsonWriter.name("isPrediction").value(words.mIsPrediction); - jsonWriter.name("words"); + jsonWriter.name("suggestedWords"); jsonWriter.beginArray(); final int size = words.size(); for (int j = 0; j < size; j++) { final SuggestedWordInfo wordInfo = words.getInfo(j); - jsonWriter.value(wordInfo.toString()); + jsonWriter.beginObject(); + jsonWriter.name("word").value(wordInfo.toString()); + jsonWriter.name("score").value(wordInfo.mScore); + jsonWriter.name("kind").value(wordInfo.mKind); + jsonWriter.name("sourceDict").value(wordInfo.mSourceDict); + jsonWriter.endObject(); } jsonWriter.endArray(); jsonWriter.endObject(); diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java index e890b74aa..6029ba963 100644 --- a/java/src/com/android/inputmethod/research/ResearchLogger.java +++ b/java/src/com/android/inputmethod/research/ResearchLogger.java @@ -1308,9 +1308,10 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang */ private static final LogStatement LOGSTATEMENT_LATINIME_PICKSUGGESTIONMANUALLY = new LogStatement("LatinIMEPickSuggestionManually", true, false, "replacedWord", "index", - "suggestion", "x", "y", "isBatchMode"); + "suggestion", "x", "y", "isBatchMode", "score", "kind", "sourceDict"); public static void latinIME_pickSuggestionManually(final String replacedWord, - final int index, final String suggestion, final boolean isBatchMode) { + final int index, final String suggestion, final boolean isBatchMode, + final int score, final int kind, final String sourceDict) { final ResearchLogger researchLogger = getInstance(); if (!replacedWord.equals(suggestion.toString())) { // The user chose something other than what was already there. @@ -1321,7 +1322,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_PICKSUGGESTIONMANUALLY, scrubDigitsFromString(replacedWord), index, suggestion == null ? null : scrubbedWord, Constants.SUGGESTION_STRIP_COORDINATE, - Constants.SUGGESTION_STRIP_COORDINATE, isBatchMode); + Constants.SUGGESTION_STRIP_COORDINATE, isBatchMode, score, kind, sourceDict); researchLogger.commitCurrentLogUnitAsWord(scrubbedWord, Long.MAX_VALUE, isBatchMode); researchLogger.mStatistics.recordManualSuggestion(SystemClock.uptimeMillis()); } @@ -1843,7 +1844,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang */ private static final LogStatement LOGSTATEMENT_LATINIME_ONENDBATCHINPUT = new LogStatement("LatinIMEOnEndBatchInput", true, false, "enteredText", - "enteredWordPos"); + "enteredWordPos", "suggestedWords"); public static void latinIME_onEndBatchInput(final CharSequence enteredText, final int enteredWordPos, final SuggestedWords suggestedWords) { final ResearchLogger researchLogger = getInstance(); @@ -1851,7 +1852,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang researchLogger.mCurrentLogUnit.setWords(enteredText.toString()); } researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_ONENDBATCHINPUT, enteredText, - enteredWordPos); + enteredWordPos, suggestedWords); researchLogger.mCurrentLogUnit.initializeSuggestions(suggestedWords); researchLogger.mStatistics.recordGestureInput(enteredText.length(), SystemClock.uptimeMillis());