aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/research/MainLogBuffer.java
diff options
context:
space:
mode:
authorKurt Partridge <kep@google.com>2012-12-23 15:12:51 -0800
committerKurt Partridge <kep@google.com>2013-01-09 16:02:37 -0800
commit3b95eaf70b0a11b1c6e0c52361fe738b4a4b2ace (patch)
tree9f3bb80f7e4fd39b4e999c2013f40816abedde3e /java/src/com/android/inputmethod/research/MainLogBuffer.java
parent125ad2237072745e4800b7a3907d5507024f35e5 (diff)
downloadlatinime-3b95eaf70b0a11b1c6e0c52361fe738b4a4b2ace.tar.gz
latinime-3b95eaf70b0a11b1c6e0c52361fe738b4a4b2ace.tar.xz
latinime-3b95eaf70b0a11b1c6e0c52361fe738b4a4b2ace.zip
[Rlog50] capture bigrams properly even with deletions
multi-project commit with Ia4ec213e8356897807cb6a278fccdbaa945732f0 Change-Id: Ib3fe886dc889954a31586ab81d00a21d8d55efd2
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;
}