aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-04-17 19:41:17 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-04-17 19:41:17 -0700
commit5351510deaf225a0d1bd3856f1847bc775d1ddfc (patch)
tree519274716570cee0cacb492969deb2e2c59adb72 /java/src
parent91290810704127b5e0ff82c2b04a54b9fe3eda9c (diff)
parent68b392cc1208036df06ca2c94176b2bc3b5a690d (diff)
downloadlatinime-5351510deaf225a0d1bd3856f1847bc775d1ddfc.tar.gz
latinime-5351510deaf225a0d1bd3856f1847bc775d1ddfc.tar.xz
latinime-5351510deaf225a0d1bd3856f1847bc775d1ddfc.zip
am 68b392cc: am d24f9397: Merge "Make shortcut-only user dict entry non-words."
* commit '68b392cc1208036df06ca2c94176b2bc3b5a690d': Make shortcut-only user dict entry non-words.
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java3
-rw-r--r--java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java7
-rw-r--r--java/src/com/android/inputmethod/latin/UserBinaryDictionary.java4
3 files changed, 8 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java
index 8b5a76a17..22d189987 100644
--- a/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ContactsBinaryDictionary.java
@@ -173,7 +173,8 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary {
// capitalization of i.
final int wordLen = StringUtils.codePointCount(word);
if (wordLen < MAX_WORD_LENGTH && wordLen > 1) {
- super.addWord(word, null /* shortcut */, FREQUENCY_FOR_CONTACTS);
+ super.addWord(word, null /* shortcut */, FREQUENCY_FOR_CONTACTS,
+ false /* isNotAWord */);
if (!TextUtils.isEmpty(prevWord)) {
if (mUseFirstLastBigrams) {
super.setBigram(prevWord, word, FREQUENCY_FOR_CONTACTS_BIGRAM);
diff --git a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
index 97dc6a8ac..4b1975a00 100644
--- a/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/ExpandableBinaryDictionary.java
@@ -176,14 +176,15 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
*/
// TODO: Create "cache dictionary" to cache fresh words for frequently updated dictionaries,
// considering performance regression.
- protected void addWord(final String word, final String shortcutTarget, final int frequency) {
+ protected void addWord(final String word, final String shortcutTarget, final int frequency,
+ final boolean isNotAWord) {
if (shortcutTarget == null) {
- mFusionDictionary.add(word, frequency, null, false /* isNotAWord */);
+ mFusionDictionary.add(word, frequency, null, isNotAWord);
} else {
// TODO: Do this in the subclass, with this class taking an arraylist.
final ArrayList<WeightedString> shortcutTargets = CollectionUtils.newArrayList();
shortcutTargets.add(new WeightedString(shortcutTarget, frequency));
- mFusionDictionary.add(word, frequency, shortcutTargets, false /* isNotAWord */);
+ mFusionDictionary.add(word, frequency, shortcutTargets, isNotAWord);
}
}
diff --git a/java/src/com/android/inputmethod/latin/UserBinaryDictionary.java b/java/src/com/android/inputmethod/latin/UserBinaryDictionary.java
index 0d5bde623..709dedd49 100644
--- a/java/src/com/android/inputmethod/latin/UserBinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/UserBinaryDictionary.java
@@ -258,10 +258,10 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary {
final int adjustedFrequency = scaleFrequencyFromDefaultToLatinIme(frequency);
// Safeguard against adding really long words.
if (word.length() < MAX_WORD_LENGTH) {
- super.addWord(word, null, adjustedFrequency);
+ super.addWord(word, null, adjustedFrequency, false /* isNotAWord */);
}
if (null != shortcut && shortcut.length() < MAX_WORD_LENGTH) {
- super.addWord(shortcut, word, adjustedFrequency);
+ super.addWord(shortcut, word, adjustedFrequency, true /* isNotAWord */);
}
cursor.moveToNext();
}