diff options
author | 2014-06-09 18:52:21 +0900 | |
---|---|---|
committer | 2014-06-10 19:52:58 +0900 | |
commit | 4863a06544081bb4998f70cdb2e7c0e5c45fdd4c (patch) | |
tree | 4fbde2ddd7099b3c2df47fcb1531ca4b3c271139 /java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java | |
parent | 2d7feb5ad0131ac70c385278a29aa5503fdfe1eb (diff) | |
download | latinime-4863a06544081bb4998f70cdb2e7c0e5c45fdd4c.tar.gz latinime-4863a06544081bb4998f70cdb2e7c0e5c45fdd4c.tar.xz latinime-4863a06544081bb4998f70cdb2e7c0e5c45fdd4c.zip |
Special case periods in the spell checker
Special case <valid word>.<valid word> to send as a suggestion
the same string where the periods is replaced by a space.
Bug: 10780091
Change-Id: I43c94675977f9ab5d7ee5671486cb742b39f3974
Diffstat (limited to 'java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java index 0032fcb88..54eebe399 100644 --- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java +++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidWordLevelSpellCheckerSession.java @@ -282,6 +282,22 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session { return AndroidSpellCheckerService.getNotInDictEmptySuggestions( false /* reportAsTypo */); } + if (CHECKABILITY_CONTAINS_PERIOD == checkability) { + final String[] splitText = inText.split(Constants.REGEXP_PERIOD); + boolean allWordsAreValid = true; + for (final String word : splitText) { + if (!dictInfo.mDictionary.isValidWord(word)) { + allWordsAreValid = false; + break; + } + } + if (allWordsAreValid) { + return new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_LOOKS_LIKE_TYPO + | SuggestionsInfo.RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS, + new String[] { + TextUtils.join(Constants.STRING_SPACE, splitText) }); + } + } return dictInfo.mDictionary.isValidWord(inText) ? AndroidSpellCheckerService.getInDictEmptySuggestions() : AndroidSpellCheckerService.getNotInDictEmptySuggestions( |