reduced the number of words+punctuation combinations only to the punctuation that make sense
This commit is contained in:
parent
d9c899f787
commit
810ef5bc5d
2 changed files with 22 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ import io.github.sspanak.tt9.db.WordStoreAsync;
|
|||
import io.github.sspanak.tt9.languages.EmojiLanguage;
|
||||
import io.github.sspanak.tt9.languages.Language;
|
||||
import io.github.sspanak.tt9.preferences.settings.SettingsStore;
|
||||
import io.github.sspanak.tt9.util.Characters;
|
||||
|
||||
public class Predictions {
|
||||
|
||||
|
|
@ -193,7 +194,9 @@ public class Predictions {
|
|||
// append all letters for the last digit in the sequence (the last pressed key)
|
||||
int lastSequenceDigit = digitSequence.charAt(digitSequence.length() - 1) - '0';
|
||||
for (String keyLetter : language.getKeyCharacters(lastSequenceDigit)) {
|
||||
generatedWords.add(baseWord + keyLetter);
|
||||
if (Character.isAlphabetic(keyLetter.charAt(0)) || Characters.isCombiningPunctuation(language, keyLetter.charAt(0))) {
|
||||
generatedWords.add(baseWord + keyLetter);
|
||||
}
|
||||
}
|
||||
|
||||
// if there are no letters for this key, just append the number
|
||||
|
|
|
|||
|
|
@ -6,13 +6,25 @@ import android.os.Build;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import io.github.sspanak.tt9.languages.Language;
|
||||
import io.github.sspanak.tt9.languages.LanguageKind;
|
||||
|
||||
public class Characters {
|
||||
private static String NEW_LINE_CHARACTER = null;
|
||||
|
||||
|
||||
final public static ArrayList<String> ArabicNumbers = new ArrayList<>(Arrays.asList(
|
||||
"٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩"
|
||||
));
|
||||
|
||||
final public static ArrayList<Character> CombiningPunctuation = new ArrayList<>(Arrays.asList(
|
||||
',', '-', '\'', ';', '!', '?', '.'
|
||||
));
|
||||
|
||||
final public static ArrayList<Character> CombiningPunctuationHebrew = new ArrayList<>(Arrays.asList(
|
||||
',' , '-', '\'', ';', '!', '?', '.', '"'
|
||||
));
|
||||
|
||||
final public static ArrayList<String> PunctuationArabic = new ArrayList<>(Arrays.asList(
|
||||
"،", ".", "-", "(", ")", "&", "~", "`", "'", "\"", "؛", ":", "!", "؟"
|
||||
));
|
||||
|
|
@ -141,4 +153,10 @@ public class Characters {
|
|||
|
||||
return NEW_LINE_CHARACTER;
|
||||
}
|
||||
|
||||
public static boolean isCombiningPunctuation(Language language, char ch) {
|
||||
return
|
||||
CombiningPunctuation.contains(ch)
|
||||
|| (LanguageKind.isHebrew(language) && CombiningPunctuationHebrew.contains(ch));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue