aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/BinaryDictionary.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-05-15 11:04:51 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-05-15 11:04:51 -0700
commit5ca33bdc5b48e90c313350baf7ad3e8c45ac4f8c (patch)
treee2e56d1d3f61fe6fd6b6dd496f62261bde04351a /java/src/com/android/inputmethod/latin/BinaryDictionary.java
parentfa51a86b314fe75f7766bc1055c5f2d93eaadd58 (diff)
parent12b35158efe759c772454059b69615b6c6b6b854 (diff)
downloadlatinime-5ca33bdc5b48e90c313350baf7ad3e8c45ac4f8c.tar.gz
latinime-5ca33bdc5b48e90c313350baf7ad3e8c45ac4f8c.tar.xz
latinime-5ca33bdc5b48e90c313350baf7ad3e8c45ac4f8c.zip
am 12b35158: am 1919072c: Merge "[ZF1] Check profanity in Java rather than in native"
* commit '12b35158efe759c772454059b69615b6c6b6b854': [ZF1] Check profanity in Java rather than in native
Diffstat (limited to 'java/src/com/android/inputmethod/latin/BinaryDictionary.java')
-rw-r--r--java/src/com/android/inputmethod/latin/BinaryDictionary.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
index dbc2b9082..03f7d1c10 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java
@@ -147,10 +147,20 @@ public final class BinaryDictionary extends Dictionary {
++len;
}
if (len > 0) {
- final int score = SuggestedWordInfo.KIND_WHITELIST == mOutputTypes[j]
+ final int flags = mOutputTypes[j] & SuggestedWordInfo.KIND_MASK_FLAGS;
+ if (0 != (flags & SuggestedWordInfo.KIND_FLAG_POSSIBLY_OFFENSIVE)
+ && 0 == (flags & SuggestedWordInfo.KIND_FLAG_EXACT_MATCH)) {
+ // If the word is possibly offensive, we don't output it unless it's also
+ // an exact match.
+ continue;
+ }
+ final int kind = mOutputTypes[j] & SuggestedWordInfo.KIND_MASK_KIND;
+ final int score = SuggestedWordInfo.KIND_WHITELIST == kind
? SuggestedWordInfo.MAX_SCORE : mOutputScores[j];
+ // TODO: check that all users of the `kind' parameter are ready to accept
+ // flags too and pass mOutputTypes[j] instead of kind
suggestions.add(new SuggestedWordInfo(new String(mOutputCodePoints, start, len),
- score, mOutputTypes[j], mDictType));
+ score, kind, mDictType));
}
}
return suggestions;