aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/SuggestedWords.java
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2014-05-26 18:45:32 +0900
committerKeisuke Kuroyanagi <ksk@google.com>2014-05-26 21:56:20 +0900
commita6278eb9c1fbe102259cba392b1459f712ca46e7 (patch)
tree40d1acf7ee7c94baabaa6c17180c18531059ce65 /java/src/com/android/inputmethod/latin/SuggestedWords.java
parent4905d83270720ce9b9121595277dae6ba8102f16 (diff)
downloadlatinime-a6278eb9c1fbe102259cba392b1459f712ca46e7.tar.gz
latinime-a6278eb9c1fbe102259cba392b1459f712ca46e7.tar.xz
latinime-a6278eb9c1fbe102259cba392b1459f712ca46e7.zip
Use whether it's exact match to detect distracters.
Bug: 13142176 Change-Id: Id5b7286d28897931f7bfe571be45d46ffeef4adf
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SuggestedWords.java')
-rw-r--r--java/src/com/android/inputmethod/latin/SuggestedWords.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java
index 758afd80a..23a6086ef 100644
--- a/java/src/com/android/inputmethod/latin/SuggestedWords.java
+++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java
@@ -225,13 +225,14 @@ public class SuggestedWords {
public static final int KIND_MASK_FLAGS = 0xFFFFFF00; // Mask to get the flags
public static final int KIND_FLAG_POSSIBLY_OFFENSIVE = 0x80000000;
public static final int KIND_FLAG_EXACT_MATCH = 0x40000000;
+ public static final int KIND_FLAG_EXACT_MATCH_WITH_INTENTIONAL_OMISSION = 0x20000000;
public final String mWord;
// The completion info from the application. Null for suggestions that don't come from
// the application (including keyboard-computed ones, so this is almost always null)
public final CompletionInfo mApplicationSpecifiedCompletionInfo;
public final int mScore;
- public final int mKind; // one of the KIND_* constants above
+ public final int mKind; // kind and kind flags
public final int mCodePointCount;
public final Dictionary mSourceDict;
// For auto-commit. This keeps track of the index inside the touch coordinates array
@@ -247,7 +248,7 @@ public class SuggestedWords {
* Create a new suggested word info.
* @param word The string to suggest.
* @param score A measure of how likely this suggestion is.
- * @param kind The kind of suggestion, as one of the above KIND_* constants.
+ * @param kind The kind of suggestion, as one of the above KIND_* constants with flags.
* @param sourceDict What instance of Dictionary produced this suggestion.
* @param indexOfTouchPointOfSecondWord See mIndexOfTouchPointOfSecondWord.
* @param autoCommitFirstWordConfidence See mAutoCommitFirstWordConfidence.
@@ -282,7 +283,11 @@ public class SuggestedWords {
}
public boolean isEligibleForAutoCommit() {
- return (KIND_CORRECTION == mKind && NOT_AN_INDEX != mIndexOfTouchPointOfSecondWord);
+ return (isKindOf(KIND_CORRECTION) && NOT_AN_INDEX != mIndexOfTouchPointOfSecondWord);
+ }
+
+ public boolean isKindOf(final int kind) {
+ return (mKind & KIND_MASK_KIND) == kind;
}
public void setDebugString(final String str) {
@@ -339,7 +344,7 @@ public class SuggestedWords {
String typedWord = null;
for (int i = 0; i < mSuggestedWordInfoList.size(); ++i) {
final SuggestedWordInfo info = mSuggestedWordInfoList.get(i);
- if (SuggestedWordInfo.KIND_TYPED != info.mKind) {
+ if (!info.isKindOf(SuggestedWordInfo.KIND_TYPED)) {
newSuggestions.add(info);
} else {
assert(null == typedWord);