Skip to content

Commit

Permalink
update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Helium314 committed Dec 11, 2023
1 parent 3107144 commit ca73709
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ public void addToUserHistory(final String suggestion, final boolean wasAutoCapit

// increase / decrease confidence if we have more than one dictionary group
boolean[] validWordForDictionary; // store results to avoid unnecessary duplicate lookups
if (mDictionaryGroups.size() > 1 && words.length == 1) {
if (mDictionaryGroups.size() > 1 && words.length == 1) { // ignore if more than a single word, this only happens with (badly working) spaceAwareGesture
validWordForDictionary = new boolean[mDictionaryGroups.size()];
// if suggestion was auto-capitalized, check against both the suggestion and the de-capitalized suggestion
final String decapitalizedSuggestion;
Expand All @@ -630,9 +630,10 @@ public void addToUserHistory(final String suggestion, final boolean wasAutoCapit

// add word to user dictionary if it is in no other dictionary except user history dictionary,
// reasoning: typing the same word again -> we probably want it in some dictionary permanently
if (mDictionaryGroups.get(0).hasDict(Dictionary.TYPE_USER_HISTORY, mDictionaryGroups.get(0).mAccount) // require personalized suggestions to be on
&& Settings.getInstance().getCurrent().mAddToPersonalDictionary // ...and the setting
&& !wasAutoCapitalized && words.length == 1) {
if (Settings.getInstance().getCurrent().mAddToPersonalDictionary // require the setting
&& mDictionaryGroups.get(0).hasDict(Dictionary.TYPE_USER_HISTORY, mDictionaryGroups.get(0).mAccount) // require personalized suggestions
&& !wasAutoCapitalized // we can't be 100% sure about what the user intended to type, so better don't add it
&& words.length == 1) { // ignore if more than a single word, this only happens with (badly working) spaceAwareGesture
addToPersonalDictionaryIfInvalidButInHistory(suggestion, validWordForDictionary);
}

Expand Down

0 comments on commit ca73709

Please sign in to comment.