am 1e7c0677: am a9dd74cf: refactor spell checker
* commit '1e7c067770b6406c762974406013db24561c2416': refactor spell checkermain
commit
4334809ff6
|
@ -283,6 +283,15 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
|
||||||
//suggestionsLimit);
|
//suggestionsLimit);
|
||||||
final SuggestionsGatherer suggestionsGatherer = mService.newSuggestionsGatherer(
|
final SuggestionsGatherer suggestionsGatherer = mService.newSuggestionsGatherer(
|
||||||
text, suggestionsLimit);
|
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 WordComposer composer = new WordComposer();
|
||||||
final int length = text.length();
|
final int length = text.length();
|
||||||
for (int i = 0; i < length; i = text.offsetByCodePoints(i, 1)) {
|
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);
|
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
|
// TODO: make a spell checker option to block offensive words or not
|
||||||
final ArrayList<SuggestedWordInfo> suggestions =
|
final ArrayList<SuggestedWordInfo> suggestions =
|
||||||
dictInfo.mDictionary.getSuggestions(composer, prevWord,
|
dictInfo.mDictionary.getSuggestions(composer, prevWord,
|
||||||
|
|
Loading…
Reference in New Issue