Merge "Log score, kind, and sourceDict for manual suggestion and gesture"

This commit is contained in:
Kurt Partridge 2013-06-14 17:03:03 +00:00 committed by Android (Google) Code Review
commit 14718ab898
3 changed files with 15 additions and 8 deletions

View File

@ -2357,7 +2357,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
LastComposedWord.NOT_A_SEPARATOR); LastComposedWord.NOT_A_SEPARATOR);
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) { if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.latinIME_pickSuggestionManually(replacedWord, index, suggestion, ResearchLogger.latinIME_pickSuggestionManually(replacedWord, index, suggestion,
mWordComposer.isBatchMode()); mWordComposer.isBatchMode(), suggestionInfo.mScore, suggestionInfo.mKind,
suggestionInfo.mSourceDict);
} }
mConnection.endBatchEdit(); mConnection.endBatchEdit();
// Don't allow cancellation of manual pick // Don't allow cancellation of manual pick

View File

@ -94,12 +94,17 @@ import java.util.Map;
.value(words.mIsPunctuationSuggestions); .value(words.mIsPunctuationSuggestions);
jsonWriter.name("isObsoleteSuggestions").value(words.mIsObsoleteSuggestions); jsonWriter.name("isObsoleteSuggestions").value(words.mIsObsoleteSuggestions);
jsonWriter.name("isPrediction").value(words.mIsPrediction); jsonWriter.name("isPrediction").value(words.mIsPrediction);
jsonWriter.name("words"); jsonWriter.name("suggestedWords");
jsonWriter.beginArray(); jsonWriter.beginArray();
final int size = words.size(); final int size = words.size();
for (int j = 0; j < size; j++) { for (int j = 0; j < size; j++) {
final SuggestedWordInfo wordInfo = words.getInfo(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.endArray();
jsonWriter.endObject(); jsonWriter.endObject();

View File

@ -1308,9 +1308,10 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
*/ */
private static final LogStatement LOGSTATEMENT_LATINIME_PICKSUGGESTIONMANUALLY = private static final LogStatement LOGSTATEMENT_LATINIME_PICKSUGGESTIONMANUALLY =
new LogStatement("LatinIMEPickSuggestionManually", true, false, "replacedWord", "index", 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, 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(); final ResearchLogger researchLogger = getInstance();
if (!replacedWord.equals(suggestion.toString())) { if (!replacedWord.equals(suggestion.toString())) {
// The user chose something other than what was already there. // 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, researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_PICKSUGGESTIONMANUALLY,
scrubDigitsFromString(replacedWord), index, scrubDigitsFromString(replacedWord), index,
suggestion == null ? null : scrubbedWord, Constants.SUGGESTION_STRIP_COORDINATE, 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.commitCurrentLogUnitAsWord(scrubbedWord, Long.MAX_VALUE, isBatchMode);
researchLogger.mStatistics.recordManualSuggestion(SystemClock.uptimeMillis()); researchLogger.mStatistics.recordManualSuggestion(SystemClock.uptimeMillis());
} }
@ -1843,7 +1844,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
*/ */
private static final LogStatement LOGSTATEMENT_LATINIME_ONENDBATCHINPUT = private static final LogStatement LOGSTATEMENT_LATINIME_ONENDBATCHINPUT =
new LogStatement("LatinIMEOnEndBatchInput", true, false, "enteredText", new LogStatement("LatinIMEOnEndBatchInput", true, false, "enteredText",
"enteredWordPos"); "enteredWordPos", "suggestedWords");
public static void latinIME_onEndBatchInput(final CharSequence enteredText, public static void latinIME_onEndBatchInput(final CharSequence enteredText,
final int enteredWordPos, final SuggestedWords suggestedWords) { final int enteredWordPos, final SuggestedWords suggestedWords) {
final ResearchLogger researchLogger = getInstance(); final ResearchLogger researchLogger = getInstance();
@ -1851,7 +1852,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
researchLogger.mCurrentLogUnit.setWords(enteredText.toString()); researchLogger.mCurrentLogUnit.setWords(enteredText.toString());
} }
researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_ONENDBATCHINPUT, enteredText, researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_ONENDBATCHINPUT, enteredText,
enteredWordPos); enteredWordPos, suggestedWords);
researchLogger.mCurrentLogUnit.initializeSuggestions(suggestedWords); researchLogger.mCurrentLogUnit.initializeSuggestions(suggestedWords);
researchLogger.mStatistics.recordGestureInput(enteredText.length(), researchLogger.mStatistics.recordGestureInput(enteredText.length(),
SystemClock.uptimeMillis()); SystemClock.uptimeMillis());