mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-17 07:22:45 +00:00
slightly tune glide typing garbage word detection
This commit is contained in:
parent
43987ad037
commit
100da1beae
1 changed files with 9 additions and 3 deletions
|
@ -898,10 +898,16 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
|
|||
// (if the main dict contains shortcuts to non-words, this will break)
|
||||
final boolean checkForGarbage = composedData.mIsBatchMode && (dictType.equals(Dictionary.TYPE_USER_HISTORY) || dictType.equals(Dictionary.TYPE_MAIN));
|
||||
for (SuggestedWordInfo info : dictionarySuggestions) {
|
||||
if (!isBlacklisted(info.getWord())) { // don't add blacklisted words
|
||||
final String word = info.getWord();
|
||||
if (!isBlacklisted(word)) { // don't add blacklisted words
|
||||
if (checkForGarbage
|
||||
&& info.mSourceDict.mDictType.equals(dictType) // to only check history and "main main dictionary", and not addons like emoji
|
||||
&& !dictionary.isInDictionary(info.getWord()))
|
||||
// only check history and "main main dictionary"
|
||||
// consider the user might use custom main dictionary containing shortcuts
|
||||
// assume this is unlikely to happen, and take care about common shortcuts that are not actual words (emoji, symbols)
|
||||
&& word.length() > 2 // should exclude most symbol shortcuts
|
||||
&& info.mSourceDict.mDictType.equals(dictType) // dictType is always main, but info.mSourceDict.mDictType contains the actual dict (main dict is a dictionary group)
|
||||
&& !StringUtils.mightBeEmoji(word) // emojis often have more than 2 chars; simplified check for performance reasons
|
||||
&& !dictionary.isInDictionary(word))
|
||||
continue;
|
||||
suggestions.add(info);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue