diff options
author | 2015-02-26 03:48:37 +0000 | |
---|---|---|
committer | 2015-02-26 03:48:37 +0000 | |
commit | 458cc72c15bbccf6ca709c4e2bfdc2c10b3c2715 (patch) | |
tree | c4a8cface9f980a7edd1841afc767136de10b62e /java/src/com/android/inputmethod/latin/Suggest.java | |
parent | d11e4cd964a0be64efd415e6f5f2ca1c14d435de (diff) | |
parent | e4619f029e84fd845b0771871218274b99c30ffa (diff) | |
download | latinime-458cc72c15bbccf6ca709c4e2bfdc2c10b3c2715.tar.gz latinime-458cc72c15bbccf6ca709c4e2bfdc2c10b3c2715.tar.xz latinime-458cc72c15bbccf6ca709c4e2bfdc2c10b3c2715.zip |
am e4619f02: Merge "Don\'t assume that correctable words are invalid"
* commit 'e4619f029e84fd845b0771871218274b99c30ffa':
Don't assume that correctable words are invalid
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Suggest.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index d4915a5e9..f4680fc88 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -210,7 +210,8 @@ public final class Suggest { } } - SuggestedWordInfo.removeDups(typedWordString, suggestionsContainer); + final int firstOcurrenceOfTypedWordInSuggestions = + SuggestedWordInfo.removeDups(typedWordString, suggestionsContainer); final SuggestedWordInfo whitelistedWordInfo = getWhitelistedWordInfoOrNull(suggestionsContainer); @@ -273,7 +274,8 @@ public final class Suggest { hasAutoCorrection = false; } else { final SuggestedWordInfo firstSuggestion = suggestionResults.first(); - if (suggestionResults.mAutocorrectRecommendation) { + if (suggestionResults.mFirstSuggestionExceedsConfidenceThreshold + && firstOcurrenceOfTypedWordInSuggestions != 0) { hasAutoCorrection = true; } else if (!AutoCorrectionUtils.suggestionExceedsThreshold( firstSuggestion, consideredWord, mAutoCorrectionThreshold)) { @@ -314,12 +316,12 @@ public final class Suggest { } else { inputStyle = inputStyleIfNotPrediction; } + + final boolean isTypedWordValid = firstOcurrenceOfTypedWordInSuggestions > -1 + || (!resultsArePredictions && !allowsToBeAutoCorrected); callback.onGetSuggestedWords(new SuggestedWords(suggestionsList, suggestionResults.mRawSuggestions, typedWordInfo, - // TODO: this first argument is lying. If this is a whitelisted word which is an - // actual word, it says typedWordValid = false, which looks wrong. We should either - // rename the attribute or change the value. - !resultsArePredictions && !allowsToBeAutoCorrected /* typedWordValid */, + isTypedWordValid, hasAutoCorrection /* willAutoCorrect */, false /* isObsoleteSuggestions */, inputStyle, sequenceNumber)); } |