aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/BinaryDictionary.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2011-04-20 11:50:05 +0900
committerJean Chalard <jchalard@google.com>2011-04-22 15:46:23 +0900
commit89bd776cf68150202d774d62cc1c88664aea5e9f (patch)
treee20df29f9763b8176be95774de35a7523f6bb7e2 /java/src/com/android/inputmethod/latin/BinaryDictionary.java
parent6c10cf6bf88e80cf48bf81c0195cd5c58b6d2940 (diff)
downloadlatinime-89bd776cf68150202d774d62cc1c88664aea5e9f.tar.gz
latinime-89bd776cf68150202d774d62cc1c88664aea5e9f.tar.xz
latinime-89bd776cf68150202d774d62cc1c88664aea5e9f.zip
Use user-history bigrams when no input if available.
This also fixes a small inconsistency upon clicking on whitespace twice in a row. Also add some unit tests for an introduced and an existing method. Change-Id: I1be2fb53c9624f4d0f5299009632cb4384fdfc15
Diffstat (limited to 'java/src/com/android/inputmethod/latin/BinaryDictionary.java')
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionary.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
index 58e9099a9..7e63aacdf 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
@@ -197,6 +197,11 @@ public class BinaryDictionary extends Dictionary {
Arrays.fill(mBigramScores, 0);
int codesSize = codes.size();
+ if (codesSize <= 0) {
+ // Do not return bigrams from BinaryDictionary when nothing was typed.
+ // Only use user-history bigrams (or whatever other bigram dictionaries decide).
+ return;
+ }
Arrays.fill(mInputCodes, -1);
int[] alternatives = codes.getCodesAt(0);
System.arraycopy(alternatives, 0, mInputCodes, 0,