diff options
author | 2014-06-12 11:36:00 +0900 | |
---|---|---|
committer | 2014-06-12 11:36:00 +0900 | |
commit | 59ed0c2db2714f36c18d0882c7845455b5b3dd43 (patch) | |
tree | db935492bd8419d467c8064d7fce58f51a9d8853 /java/src/com/android/inputmethod/latin/BinaryDictionary.java | |
parent | d979d416c102c45773f4684473953f6fed8f983f (diff) | |
download | latinime-59ed0c2db2714f36c18d0882c7845455b5b3dd43.tar.gz latinime-59ed0c2db2714f36c18d0882c7845455b5b3dd43.tar.xz latinime-59ed0c2db2714f36c18d0882c7845455b5b3dd43.zip |
Block offensive words in native code.
Bug: 15300452
Change-Id: Ic6c91c47453e19fb5db2c62b66659619e72b1ecf
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; |