1
0
Fork 0

Dictionaries update (#80)

* added missing words to the Bulgarian dictionary

* English dictionary update

* removed repeating words from the Italian and Bulgarian dictionaries

* fixed incorrectly broken words and removed repeating ones from the Ukrainian dictionary

* Russian dictionary update

* documentation update

* made it possible to type words with apostrophes (Dutch, English and Ukrainian)
This commit is contained in:
Dimo Karaivanov 2022-10-24 13:32:31 +03:00 committed by GitHub
parent 6c19edc8a3
commit 8b67929a07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 187613 additions and 57933 deletions

View file

@ -183,7 +183,7 @@ public class TraditionalT9 extends KeyPadHandler {
* @return boolean
*/
protected boolean onNumber(int key, boolean hold, boolean repeat) {
if (mInputMode.shouldAcceptCurrentSuggestion(key, hold, repeat)) {
if (mInputMode.shouldAcceptCurrentSuggestion(mLanguage, key, hold, repeat)) {
mInputMode.onAcceptSuggestion(mLanguage, getComposingText());
commitCurrentSuggestion(false);
determineNextTextCase();

View file

@ -83,6 +83,6 @@ abstract public class InputMode {
public boolean shouldTrackNumPress() { return true; }
public boolean shouldTrackUpDown() { return false; }
public boolean shouldTrackLeftRight() { return false; }
public boolean shouldAcceptCurrentSuggestion(int key, boolean hold, boolean repeat) { return false; }
public boolean shouldAcceptCurrentSuggestion(Language language, int key, boolean hold, boolean repeat) { return false; }
public boolean shouldSelectNextSuggestion() { return false; }
}

View file

@ -33,7 +33,7 @@ public class ModeABC extends InputMode {
final public boolean isABC() { return true; }
public int getSequenceLength() { return 1; }
public boolean shouldAcceptCurrentSuggestion(int key, boolean hold, boolean repeat) { return hold || !repeat; }
public boolean shouldAcceptCurrentSuggestion(Language l, int key, boolean hold, boolean repeat) { return hold || !repeat; }
public boolean shouldTrackUpDown() { return true; }
public boolean shouldTrackLeftRight() { return true; }
public boolean shouldSelectNextSuggestion() {

View file

@ -105,16 +105,16 @@ public class ModePredictive extends InputMode {
* In this mode, In addition to confirming the suggestion in the input field,
* we also increase its' priority. This function determines whether we want to do all this or not.
*/
public boolean shouldAcceptCurrentSuggestion(int key, boolean hold, boolean repeat) {
public boolean shouldAcceptCurrentSuggestion(Language language, int key, boolean hold, boolean repeat) {
return
hold
// Quickly accept suggestions using "space" instead of pressing "ok" then "space"
|| key == 0
// Punctuation is considered "a word", so that we can increase the priority as needed
// Also, it must break the current word.
|| (key == 1 && digitSequence.length() > 0 && !digitSequence.endsWith("1"))
|| (!language.isPunctuationPartOfWords() && key == 1 && digitSequence.length() > 0 && !digitSequence.endsWith("1"))
// On the other hand, letters also "break" punctuation.
|| (key != 1 && digitSequence.endsWith("1"));
|| (!language.isPunctuationPartOfWords() && key != 1 && digitSequence.endsWith("1"));
}

View file

@ -8,6 +8,7 @@ public class Language {
protected int id;
protected String name;
protected Locale locale;
protected boolean isPunctuationPartOfWords; // see the getter for more info
protected int icon;
protected String dictionaryFile;
protected int abcLowerCaseIcon;
@ -30,6 +31,24 @@ public class Language {
return icon;
}
/**
* isPunctuationPartOfWords
* This plays a role in Predictive mode only.
*
* Return "true", if you need to use the 1-key for typing words, such as:
* "it's" (English), "a'tje" (Dutch), "п'ят" (Ukrainian).
*
* Return "false" also:
* - hide words like the above from the suggestions.
* - 1-key would commit the current word, then display the punctuation list.
* For example, pressing 1-key after "it" would accept "it" as a separate word,
* then display only: | , | . | ! | ? | ...
*
* "false" is recommended when apostrophes or other punctuation are not part of the words,
* because it would allow faster typing.
*/
final public boolean isPunctuationPartOfWords() { return isPunctuationPartOfWords; }
final public String getDictionaryFile() {
return dictionaryFile;
}

View file

@ -14,6 +14,7 @@ public class Bulgarian extends Language {
name = "български";
locale = new Locale("bg","BG");
dictionaryFile = "bg-utf8.txt";
isPunctuationPartOfWords = false;
icon = R.drawable.ime_lang_bg;
abcLowerCaseIcon = R.drawable.ime_lang_cyrillic_lower;
abcUpperCaseIcon = R.drawable.ime_lang_cyrillic_upper;

View file

@ -12,13 +12,14 @@ public class Dutch extends English {
id = 8;
name = "Nederlands";
locale = new Locale("nl","NL");
isPunctuationPartOfWords = true;
dictionaryFile = "nl-utf8.txt";
icon = R.drawable.ime_lang_nl;
characterMap.get(2).addAll(Arrays.asList("à", "ä", "ç"));
characterMap.get(3).addAll(Arrays.asList("é", "è", "ê", "ë"));
characterMap.get(4).addAll(Arrays.asList("î", "ï"));
characterMap.get(6).addAll(Arrays.asList("ö"));
characterMap.get(6).add("ö");
characterMap.get(8).addAll(Arrays.asList("û", "ü"));
}
}

View file

@ -14,6 +14,7 @@ public class English extends Language {
name = "English";
locale = Locale.ENGLISH;
dictionaryFile = "en-utf8.txt";
isPunctuationPartOfWords = true;
icon = R.drawable.ime_lang_en;
abcLowerCaseIcon = R.drawable.ime_lang_latin_lower;
abcUpperCaseIcon = R.drawable.ime_lang_latin_upper;

View file

@ -14,6 +14,7 @@ public class French extends English {
locale = Locale.FRENCH;
dictionaryFile = "fr-utf8.txt";
icon = R.drawable.ime_lang_fr;
isPunctuationPartOfWords = false;
characterMap.get(2).addAll(Arrays.asList("à", "â", "æ", "ç"));
characterMap.get(3).addAll(Arrays.asList("é", "è", "ê", "ë"));

View file

@ -13,6 +13,7 @@ public class German extends English {
locale = Locale.GERMAN;
dictionaryFile = "de-utf8.txt";
icon = R.drawable.ime_lang_de;
isPunctuationPartOfWords = false;
characterMap.get(2).add("ä");
characterMap.get(6).add("ö");

View file

@ -14,6 +14,7 @@ public class Italian extends English {
locale = Locale.ITALIAN;
dictionaryFile = "it-utf8.txt";
icon = R.drawable.ime_lang_it;
isPunctuationPartOfWords = false;
characterMap.get(2).add("à");
characterMap.get(3).addAll(Arrays.asList("é", "è"));

View file

@ -14,6 +14,7 @@ public class Russian extends Language {
name = "русский";
locale = new Locale("ru","RU");
dictionaryFile = "ru-utf8.txt";
isPunctuationPartOfWords = false;
icon = R.drawable.ime_lang_ru;
abcLowerCaseIcon = R.drawable.ime_lang_cyrillic_lower;
abcUpperCaseIcon = R.drawable.ime_lang_cyrillic_upper;

View file

@ -14,6 +14,7 @@ public class Ukrainian extends Language {
name = "українська";
locale = new Locale("uk","UA");
dictionaryFile = "uk-utf8.txt";
isPunctuationPartOfWords = true;
icon = R.drawable.ime_lang_uk;
abcLowerCaseIcon = R.drawable.ime_lang_cyrillic_lower;
abcUpperCaseIcon = R.drawable.ime_lang_cyrillic_upper;