diff options
author | 2014-06-12 03:22:25 +0000 | |
---|---|---|
committer | 2014-06-10 22:36:02 +0000 | |
commit | ec59371ff88f2fb1f4dd25d2fc5c06cb39f5152e (patch) | |
tree | 596e2f63b7cbbf8130af74602a20d66bceada8ac /java/src/com/android/inputmethod/latin/BinaryDictionary.java | |
parent | c49c9c52bec44303923001af554c160a4117d071 (diff) | |
parent | 59ed0c2db2714f36c18d0882c7845455b5b3dd43 (diff) | |
download | latinime-ec59371ff88f2fb1f4dd25d2fc5c06cb39f5152e.tar.gz latinime-ec59371ff88f2fb1f4dd25d2fc5c06cb39f5152e.tar.xz latinime-ec59371ff88f2fb1f4dd25d2fc5c06cb39f5152e.zip |
Merge "Block offensive words in native code."
Diffstat (limited to 'java/src/com/android/inputmethod/latin/BinaryDictionary.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/BinaryDictionary.java | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionary.java b/java/src/com/android/inputmethod/latin/BinaryDictionary.java index 1d087439d..4dbfb44d6 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionary.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionary.java @@ -292,6 +292,7 @@ public final class BinaryDictionary extends Dictionary { } mNativeSuggestOptions.setIsGesture(isGesture); + mNativeSuggestOptions.setBlockOffensiveWords(blockOffensiveWords); mNativeSuggestOptions.setAdditionalFeaturesOptions(additionalFeaturesOptions); if (inOutLanguageWeight != null) { mInputOutputLanguageWeight[0] = inOutLanguageWeight[0]; @@ -319,18 +320,10 @@ public final class BinaryDictionary extends Dictionary { ++len; } if (len > 0) { - final SuggestedWordInfo suggestedWordInfo = - new SuggestedWordInfo(new String(mOutputCodePoints, start, len), - mOutputScores[j], mOutputTypes[j], this /* sourceDict */, - mSpaceIndices[j] /* indexOfTouchPointOfSecondWord */, - mOutputAutoCommitFirstWordConfidence[0]); - if (blockOffensiveWords && suggestedWordInfo.isPossiblyOffensive() - && !suggestedWordInfo.isExactMatch()) { - // If we block potentially offensive words, and if the word is possibly - // offensive, then we don't output it unless it's also an exact match. - continue; - } - suggestions.add(suggestedWordInfo); + suggestions.add(new SuggestedWordInfo(new String(mOutputCodePoints, start, len), + mOutputScores[j], mOutputTypes[j], this /* sourceDict */, + mSpaceIndices[j] /* indexOfTouchPointOfSecondWord */, + mOutputAutoCommitFirstWordConfidence[0])); } } return suggestions; |