aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/research/ResearchLogger.java
diff options
context:
space:
mode:
authorKurt Partridge <kep@google.com>2012-08-28 10:26:21 -0700
committerKurt Partridge <kep@google.com>2012-12-23 12:33:16 -0800
commitf763dc5915d394378bdcdc90cc0b238e66926b8b (patch)
tree430baf6027ae7414fc1c38b586385fdfda29f84f /java/src/com/android/inputmethod/research/ResearchLogger.java
parent13b1be988d49818c48949d2534ffe31ed8475cfb (diff)
downloadlatinime-f763dc5915d394378bdcdc90cc0b238e66926b8b.tar.gz
latinime-f763dc5915d394378bdcdc90cc0b238e66926b8b.tar.xz
latinime-f763dc5915d394378bdcdc90cc0b238e66926b8b.zip
[Rlog24] ResearchLogger detect word boundaries in callers above commitText
multi project commit with I5847d4aba97a7224ae170a7153811c5a11816449 Change-Id: Ie6fbf6f19f0193451fe6f3ddf9d4ef1637a35db1
Diffstat (limited to 'java/src/com/android/inputmethod/research/ResearchLogger.java')
-rw-r--r--java/src/com/android/inputmethod/research/ResearchLogger.java63
1 files changed, 39 insertions, 24 deletions
diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java
index ec3d4eda4..cde100a5f 100644
--- a/java/src/com/android/inputmethod/research/ResearchLogger.java
+++ b/java/src/com/android/inputmethod/research/ResearchLogger.java
@@ -741,7 +741,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
private static final LogStatement LOGSTATEMENT_COMMIT_RECORD_SPLIT_WORDS =
new LogStatement("recordSplitWords", true, false);
- private void onWordComplete(final String word, final long maxTime, final boolean isSplitWords) {
+ public void onWordComplete(final String word, final long maxTime) {
final Dictionary dictionary = getDictionary();
if (word != null && word.length() > 0 && hasLetters(word)) {
mCurrentLogUnit.setWord(word);
@@ -751,11 +751,6 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
}
final LogUnit newLogUnit = mCurrentLogUnit.splitByTime(maxTime);
enqueueCommitText(word);
- if (isSplitWords) {
- enqueueEvent(LOGSTATEMENT_COMMIT_RECORD_SPLIT_WORDS);
- enqueueCommitText(" ");
- mStatistics.recordSplitWords();
- }
commitCurrentLogUnit();
mCurrentLogUnit = newLogUnit;
}
@@ -1049,12 +1044,15 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
new LogStatement("LatinIMEPickSuggestionManually", true, false, "replacedWord", "index",
"suggestion", "x", "y");
public static void latinIME_pickSuggestionManually(final String replacedWord,
- final int index, CharSequence suggestion) {
+ final int index, final String suggestion) {
+ final String scrubbedWord = scrubDigitsFromString(suggestion);
final ResearchLogger researchLogger = getInstance();
researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_PICKSUGGESTIONMANUALLY,
scrubDigitsFromString(replacedWord), index,
- suggestion == null ? null : scrubDigitsFromString(suggestion.toString()),
- Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE);
+ suggestion == null ? null : scrubbedWord, Constants.SUGGESTION_STRIP_COORDINATE,
+ Constants.SUGGESTION_STRIP_COORDINATE);
+ researchLogger.onWordComplete(scrubbedWord, Long.MAX_VALUE);
+ researchLogger.mStatistics.recordManualSuggestion();
}
/**
@@ -1065,10 +1063,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
private static final LogStatement LOGSTATEMENT_LATINIME_PUNCTUATIONSUGGESTION =
new LogStatement("LatinIMEPunctuationSuggestion", false, false, "index", "suggestion",
"x", "y");
- public static void latinIME_punctuationSuggestion(final int index,
- final CharSequence suggestion) {
- getInstance().enqueueEvent(LOGSTATEMENT_LATINIME_PUNCTUATIONSUGGESTION, index, suggestion,
+ public static void latinIME_punctuationSuggestion(final int index, final String suggestion) {
+ final ResearchLogger researchLogger = getInstance();
+ researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_PUNCTUATIONSUGGESTION, index, suggestion,
Constants.SUGGESTION_STRIP_COORDINATE, Constants.SUGGESTION_STRIP_COORDINATE);
+ researchLogger.onWordComplete(suggestion, Long.MAX_VALUE);
}
/**
@@ -1147,9 +1146,14 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
* backspace.
*/
private static final LogStatement LOGSTATEMENT_LATINIME_REVERTCOMMIT =
- new LogStatement("LatinIMERevertCommit", true, false, "originallyTypedWord");
- public static void latinIME_revertCommit(final String originallyTypedWord) {
- getInstance().enqueueEvent(LOGSTATEMENT_LATINIME_REVERTCOMMIT, originallyTypedWord);
+ new LogStatement("LatinIMERevertCommit", true, false, "committedWord",
+ "originallyTypedWord");
+ public static void latinIME_revertCommit(final String committedWord,
+ final String originallyTypedWord) {
+ final ResearchLogger researchLogger = getInstance();
+ researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_REVERTCOMMIT, committedWord,
+ originallyTypedWord);
+ researchLogger.mStatistics.recordRevertCommit();
}
/**
@@ -1259,17 +1263,27 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
final ResearchLogger researchLogger = getInstance();
researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_COMMITCURRENTAUTOCORRECTION,
scrubbedTypedWord, scrubbedAutoCorrection, separatorString);
- researchLogger.onWordComplete(scrubbedAutoCorrection, Long.MAX_VALUE,
- false /* isPartial */);
+ researchLogger.onWordComplete(scrubbedAutoCorrection, Long.MAX_VALUE);
}
private boolean isExpectingCommitText = false;
+ /**
+ * Log a call to RichInputConnection.commitPartialText
+ *
+ * SystemResponse: The IME is committing part of a word. This happens if a space is
+ * automatically inserted to split a single typed string into two or more words.
+ */
+ // TODO: This method is currently unused. Find where it should be called from in the IME and
+ // add invocations.
+ private static final LogStatement LOGSTATEMENT_LATINIME_COMMIT_PARTIAL_TEXT =
+ new LogStatement("LatinIMECommitPartialText", true, false, "newCursorPosition");
public static void latinIME_commitPartialText(final CharSequence committedWord,
final long lastTimestampOfWordData) {
final ResearchLogger researchLogger = getInstance();
final String scrubbedWord = scrubDigitsFromString(committedWord.toString());
- researchLogger.onWordComplete(scrubbedWord, lastTimestampOfWordData, true /* isPartial */);
- researchLogger.isExpectingCommitText = true;
+ researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_COMMIT_PARTIAL_TEXT);
+ researchLogger.onWordComplete(scrubbedWord, lastTimestampOfWordData);
+ researchLogger.mStatistics.recordSplitWords();
}
/**
@@ -1287,7 +1301,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
if (!researchLogger.isExpectingCommitText) {
researchLogger.enqueueEvent(LOGSTATEMENT_RICHINPUTCONNECTIONCOMMITTEXT,
newCursorPosition);
- researchLogger.onWordComplete(scrubbedWord, Long.MAX_VALUE, false /* isPartial */);
+ researchLogger.onWordComplete(scrubbedWord, Long.MAX_VALUE);
}
researchLogger.isExpectingCommitText = false;
}
@@ -1465,7 +1479,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
"isEmptinessStateKnown", "averageTimeBetweenKeys", "averageTimeBeforeDelete",
"averageTimeDuringRepeatedDelete", "averageTimeAfterDelete",
"dictionaryWordCount", "splitWordsCount", "gestureInputCount",
- "gestureCharsCount", "gesturesDeletedCount");
+ "gestureCharsCount", "gesturesDeletedCount", "manualSuggestionsCount",
+ "revertCommitsCount");
private static void logStatistics() {
final ResearchLogger researchLogger = getInstance();
final Statistics statistics = researchLogger.mStatistics;
@@ -1477,8 +1492,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
statistics.mDuringRepeatedDeleteKeysCounter.getAverageTime(),
statistics.mAfterDeleteKeyCounter.getAverageTime(),
statistics.mDictionaryWordCount, statistics.mSplitWordsCount,
- statistics.mGesturesInputCount,
- statistics.mGesturesCharsCount,
- statistics.mGesturesDeletedCount);
+ statistics.mGesturesInputCount, statistics.mGesturesCharsCount,
+ statistics.mGesturesDeletedCount, statistics.mManualSuggestionsCount,
+ statistics.mRevertCommitsCount);
}
}