1
0
Fork 0

regression: impossible to update the frequencies of words with apostrophes

This commit is contained in:
sspanak 2024-12-04 10:25:43 +02:00
parent 267b3f6270
commit 00e00e1802

View file

@ -17,6 +17,7 @@ import io.github.sspanak.tt9.languages.exceptions.InvalidLanguageCharactersExcep
import io.github.sspanak.tt9.preferences.settings.SettingsStore; import io.github.sspanak.tt9.preferences.settings.SettingsStore;
import io.github.sspanak.tt9.util.Logger; import io.github.sspanak.tt9.util.Logger;
import io.github.sspanak.tt9.util.Text; import io.github.sspanak.tt9.util.Text;
import io.github.sspanak.tt9.util.TextTools;
class ModeWords extends ModeCheonjiin { class ModeWords extends ModeCheonjiin {
private final String LOG_TAG = getClass().getSimpleName(); private final String LOG_TAG = getClass().getSimpleName();
@ -311,15 +312,19 @@ class ModeWords extends ModeCheonjiin {
return; return;
} }
// emojis and special chars are not in the database, so there is no point in wasting resources if (TextTools.isGraphic(currentWord) || new Text(currentWord).isNumeric()) {
// running queries on them
if (!new Text(currentWord).isAlphabetic()) {
return; return;
} }
try { try {
// special chars are not in the database, no need to run queries on them
String digitSequence = language.getDigitSequenceForWord(currentWord);
if (digitSequence.equals(SPECIAL_CHAR_SEQUENCE) || digitSequence.equals(PUNCTUATION_SEQUENCE)) {
return;
}
// increment the frequency of the given word // increment the frequency of the given word
predictions.onAccept(currentWord, language.getDigitSequenceForWord(currentWord)); predictions.onAccept(currentWord, digitSequence);
} catch (Exception e) { } catch (Exception e) {
Logger.e(LOG_TAG, "Failed incrementing priority of word: '" + currentWord + "'. " + e.getMessage()); Logger.e(LOG_TAG, "Failed incrementing priority of word: '" + currentWord + "'. " + e.getMessage());
} }