Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8afa2fb authored by Jean Chalard's avatar Jean Chalard
Browse files

Remove the ultimate code duplication (A111)

Change-Id: I7c76613df8f148feb02765f187db3ca6dc577977
parent 3b57631b
Loading
Loading
Loading
Loading
+5 −14
Original line number Diff line number Diff line
@@ -192,21 +192,12 @@ public class Suggest {
        } else {
            wordComposerForLookup = wordComposer;
        }
        if (wordComposerForLookup.size() <= 1) {
            // At first character typed, search only the bigrams
            for (final String key : mDictionaries.keySet()) {
                final Dictionary dictionary = mDictionaries.get(key);
                suggestionsSet.addAll(dictionary.getSuggestions(
                        wordComposerForLookup, prevWordForBigram, proximityInfo));
            }
        } else {
            // At second character typed, search the unigrams (scores being affected by bigrams)

        for (final String key : mDictionaries.keySet()) {
            final Dictionary dictionary = mDictionaries.get(key);
            suggestionsSet.addAll(dictionary.getSuggestions(
                    wordComposerForLookup, prevWordForBigram, proximityInfo));
        }
        }

        // TODO: Change this scheme - a boolean is not enough. A whitelisted word may be "valid"
        // but still autocorrected from - in the case the whitelist only capitalizes the word.