From 3b95eaf70b0a11b1c6e0c52361fe738b4a4b2ace Mon Sep 17 00:00:00 2001 From: Kurt Partridge Date: Sun, 23 Dec 2012 15:12:51 -0800 Subject: [Rlog50] capture bigrams properly even with deletions multi-project commit with Ia4ec213e8356897807cb6a278fccdbaa945732f0 Change-Id: Ib3fe886dc889954a31586ab81d00a21d8d55efd2 --- java/src/com/android/inputmethod/research/MainLogBuffer.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'java/src/com/android/inputmethod/research/MainLogBuffer.java') 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 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; } -- cgit v1.2.3-83-g751a