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

Commit a9dd74cf authored by Satoshi Kataoka's avatar Satoshi Kataoka
Browse files

refactor spell checker

Change-Id: Ie7bea23f2ac54f03572e77c31ba7cb3d5e8f8d2f
parent 9d71a6c9
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -283,6 +283,15 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
            //suggestionsLimit);
            final SuggestionsGatherer suggestionsGatherer = mService.newSuggestionsGatherer(
                    text, suggestionsLimit);

            final int capitalizeType = StringUtils.getCapitalizationType(text);
            boolean isInDict = true;
            DictAndProximity dictInfo = null;
            try {
                dictInfo = mDictionaryPool.pollWithDefaultTimeout();
                if (!DictionaryPool.isAValidDictionary(dictInfo)) {
                    return AndroidSpellCheckerService.getNotInDictEmptySuggestions();
                }
                final WordComposer composer = new WordComposer();
                final int length = text.length();
                for (int i = 0; i < length; i = text.offsetByCodePoints(i, 1)) {
@@ -297,15 +306,6 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
                        composer.add(codePoint, xy & 0xFFFF, xy >> 16);
                    }
                }

            final int capitalizeType = StringUtils.getCapitalizationType(text);
            boolean isInDict = true;
            DictAndProximity dictInfo = null;
            try {
                dictInfo = mDictionaryPool.pollWithDefaultTimeout();
                if (!DictionaryPool.isAValidDictionary(dictInfo)) {
                    return AndroidSpellCheckerService.getNotInDictEmptySuggestions();
                }
                // TODO: make a spell checker option to block offensive words or not
                final ArrayList<SuggestedWordInfo> suggestions =
                        dictInfo.mDictionary.getSuggestions(composer, prevWord,