aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/research/MainLogBuffer.java
diff options
context:
space:
mode:
authorKurt Partridge <kep@google.com>2013-01-09 19:54:33 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2013-01-09 19:54:33 -0800
commit2ae3909b207ad42a79333e29a6f933d1981dc8ec (patch)
treefa6d64756bbd304273c84bc9ab725198942ad039 /java/src/com/android/inputmethod/research/MainLogBuffer.java
parent868dc985cf0a857f6d6d554aa33f00f174731dcb (diff)
parentf11c4a9aeb9b08d6c0c29861c3d9832334834d90 (diff)
downloadlatinime-2ae3909b207ad42a79333e29a6f933d1981dc8ec.tar.gz
latinime-2ae3909b207ad42a79333e29a6f933d1981dc8ec.tar.xz
latinime-2ae3909b207ad42a79333e29a6f933d1981dc8ec.zip
am f11c4a9a: Merge "[Rlog50] capture bigrams properly even with deletions"
* commit 'f11c4a9aeb9b08d6c0c29861c3d9832334834d90': [Rlog50] capture bigrams properly even with deletions
Diffstat (limited to 'java/src/com/android/inputmethod/research/MainLogBuffer.java')
-rw-r--r--java/src/com/android/inputmethod/research/MainLogBuffer.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/research/MainLogBuffer.java b/java/src/com/android/inputmethod/research/MainLogBuffer.java
index bec21d7e0..898a042d6 100644
--- a/java/src/com/android/inputmethod/research/MainLogBuffer.java
+++ b/java/src/com/android/inputmethod/research/MainLogBuffer.java
@@ -119,6 +119,7 @@ public class MainLogBuffer extends FixedLogBuffer {
// complete buffer contents in detail.
final LinkedList<LogUnit> logUnits = getLogUnits();
final int length = logUnits.size();
+ int wordsFound = 0;
for (int i = 0; i < length; i++) {
final LogUnit logUnit = logUnits.get(i);
final String word = logUnit.getWord();
@@ -135,9 +136,18 @@ public class MainLogBuffer extends FixedLogBuffer {
+ ", isValid: " + (dictionary.isValidWord(word)));
}
return false;
+ } else {
+ wordsFound++;
}
}
}
+ if (wordsFound < N_GRAM_SIZE) {
+ // Not enough words. Not unsafe, but reject anyway.
+ if (DEBUG) {
+ Log.d(TAG, "not enough words");
+ }
+ return false;
+ }
// All checks have passed; this buffer's content can be safely uploaded.
return true;
}