aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/res/xml/prefs.xml16
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionary.java15
2 files changed, 13 insertions, 18 deletions
diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml
index dcaa2029c..77f46502e 100644
--- a/java/res/xml/prefs.xml
+++ b/java/res/xml/prefs.xml
@@ -114,6 +114,13 @@
android:persistent="true"
android:defaultValue="true" />
<CheckBoxPreference
+ android:key="bigram_prediction"
+ android:dependency="bigram_suggestion"
+ android:title="@string/bigram_prediction"
+ android:summary="@string/bigram_prediction_summary"
+ android:persistent="true"
+ android:defaultValue="false" />
+ <CheckBoxPreference
android:key="enable_span_insert"
android:title="@string/enable_span_insert"
android:summary="@string/enable_span_insert_summary"
@@ -125,15 +132,6 @@
<PreferenceScreen
android:key="pref_keypress_sound_volume"
android:title="@string/prefs_keypress_sound_volume_settings" />
- <!-- TODO: evaluate results and revive this option. The code
- already supports it. -->
- <!-- <CheckBoxPreference -->
- <!-- android:key="bigram_prediction" -->
- <!-- android:dependency="bigram_suggestion" -->
- <!-- android:title="@string/bigram_prediction" -->
- <!-- android:summary="@string/bigram_prediction_summary" -->
- <!-- android:persistent="true" -->
- <!-- android:defaultValue="false" /> -->
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
index b82400046..90ced6028 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
@@ -139,22 +139,19 @@ 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,
- Math.min(alternatives.length, MAX_PROXIMITY_CHARS_SIZE));
+ if (codesSize > 0) {
+ int[] alternatives = codes.getCodesAt(0);
+ System.arraycopy(alternatives, 0, mInputCodes, 0,
+ Math.min(alternatives.length, MAX_PROXIMITY_CHARS_SIZE));
+ }
int count = getBigramsNative(mNativeDict, chars, chars.length, mInputCodes, codesSize,
mOutputChars_bigrams, mBigramScores, MAX_WORD_LENGTH, MAX_BIGRAMS,
MAX_PROXIMITY_CHARS_SIZE);
for (int j = 0; j < count; ++j) {
- if (mBigramScores[j] < 1) break;
+ if (codesSize > 0 && mBigramScores[j] < 1) break;
final int start = j * MAX_WORD_LENGTH;
int len = 0;
while (len < MAX_WORD_LENGTH && mOutputChars_bigrams[start + len] != 0) {