Merge "Remove some special casing"
commit
4ef01c51f8
|
@ -394,34 +394,17 @@ public class Suggest {
|
||||||
final int score = wordInfo.mScore;
|
final int score = wordInfo.mScore;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
// Check if it's the same word, only caps are different
|
// Check the last one's score and bail
|
||||||
if (StringUtils.equalsIgnoreCase(consideredWord, word)) {
|
if (suggestions.size() >= prefMaxSuggestions
|
||||||
// TODO: remove this surrounding if clause and move this logic to
|
&& suggestions.get(prefMaxSuggestions - 1).mScore >= score) return true;
|
||||||
// getSuggestedWordBuilder.
|
final int length = wordInfo.mCodePointCount;
|
||||||
if (suggestions.size() > 0) {
|
while (pos < suggestions.size()) {
|
||||||
final SuggestedWordInfo currentHighestWord = suggestions.get(0);
|
final int curScore = suggestions.get(pos).mScore;
|
||||||
// If the current highest word is also equal to typed word, we need to compare
|
if (curScore < score
|
||||||
// frequency to determine the insertion position. This does not ensure strictly
|
|| (curScore == score && length < suggestions.get(pos).mCodePointCount)) {
|
||||||
// correct ordering, but ensures the top score is on top which is enough for
|
break;
|
||||||
// removing duplicates correctly.
|
|
||||||
if (StringUtils.equalsIgnoreCase(currentHighestWord.mWord, word)
|
|
||||||
&& score <= currentHighestWord.mScore) {
|
|
||||||
pos = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Check the last one's score and bail
|
|
||||||
if (suggestions.size() >= prefMaxSuggestions
|
|
||||||
&& suggestions.get(prefMaxSuggestions - 1).mScore >= score) return true;
|
|
||||||
final int length = wordInfo.mCodePointCount;
|
|
||||||
while (pos < suggestions.size()) {
|
|
||||||
final int curScore = suggestions.get(pos).mScore;
|
|
||||||
if (curScore < score
|
|
||||||
|| (curScore == score && length < suggestions.get(pos).mCodePointCount)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
pos++;
|
|
||||||
}
|
}
|
||||||
|
pos++;
|
||||||
}
|
}
|
||||||
if (pos >= prefMaxSuggestions) {
|
if (pos >= prefMaxSuggestions) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue