From 86dee2295dccd9af3c58e946bc8f2b62736c0260 Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Thu, 10 Jul 2014 16:21:31 +0900 Subject: Quit sorting suggestions in AndroidSpellCheckerService. Suggestions have been sorted in SuggestionResults. Bug: 13689011 Change-Id: Iec21e97119ceb7c71673d5b15bb1f06040b59fef --- .../AndroidWordLevelSpellCheckerSession.java | 23 +++++----------------- 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java') diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java index 19c1dd0a5..ca0725e28 100644 --- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java +++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java @@ -259,14 +259,6 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session { } final String text = inText.replaceAll( AndroidSpellCheckerService.APOSTROPHE, AndroidSpellCheckerService.SINGLE_QUOTE); - - // TODO: Don't gather suggestions if the limit is <= 0 unless necessary - //final SuggestionsGatherer suggestionsGatherer = new SuggestionsGatherer(text, - //mService.mSuggestionThreshold, mService.mRecommendedThreshold, - //suggestionsLimit); - final SuggestionsGatherer suggestionsGatherer = mService.newSuggestionsGatherer( - text, suggestionsLimit); - final int capitalizeType = StringUtils.getCapitalizationType(text); boolean isInDict = true; if (!mService.hasMainDictionaryForLocale(mLocale)) { @@ -289,18 +281,13 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session { composer.setComposingWord(codePoints, coordinates); final SuggestionResults suggestionResults = mService.getSuggestionResults( mLocale, composer, prevWordsInfo, proximityInfo); - if (suggestionResults != null) { - for (final SuggestedWordInfo suggestion : suggestionResults) { - final String suggestionStr = suggestion.mWord; - suggestionsGatherer.addWord(suggestionStr.toCharArray(), null, 0, - suggestionStr.length(), suggestion.mScore); - } - } - isInDict = isInDictForAnyCapitalization(text, capitalizeType); - + // TODO: Don't gather suggestions if the limit is <= 0 unless necessary + final SuggestionsGatherer suggestionsGatherer = mService.newSuggestionsGatherer( + text, suggestionsLimit); + suggestionsGatherer.addResults(suggestionResults); final SuggestionsGatherer.Result result = suggestionsGatherer.getResults( capitalizeType, mLocale); - + isInDict = isInDictForAnyCapitalization(text, capitalizeType); if (DBG) { Log.i(TAG, "Spell checking results for " + text + " with suggestion limit " + suggestionsLimit); -- cgit v1.2.3-83-g751a