1
0
Fork 0

removed the capital letter hack and added a new one, only for the English I, in DictionaryLoader

removed some unused code and fixed a spelling mistake
This commit is contained in:
sspanak 2023-07-03 12:19:23 +03:00 committed by Dimo Karaivanov
parent dc0468ffeb
commit 17e9b779e6
6 changed files with 6 additions and 24 deletions

View file

@ -4,7 +4,6 @@
'll 'll
're 're
've 've
I
abs 62 abs 62
cia 118 cia 118
co co

Can't render this file because it is too large.

View file

@ -1540,7 +1540,6 @@ Bélgica 116
Bétera Bétera
Bóntoc Bóntoc
Búrbura Búrbura
C
CD CD
CFE CFE
CNDH CNDH
@ -4020,7 +4019,6 @@ Fátima
Félix 111 Félix 111
Fómeque Fómeque
Fúquene Fúquene
G
GPS GPS
Gabaldón Gabaldón
Gaban Gaban
@ -4858,7 +4856,6 @@ Huépil
Hábita Hábita
Héctor Héctor
Héroes 118 Héroes 118
I
IMSS 89 IMSS 89
INE 124 INE 124
INEGI 100 INEGI 100
@ -6829,7 +6826,6 @@ Múgica
Múnera Múnera
Mútis Mútis
Múzquiz Múzquiz
N
NIF NIF
Naaguán Naaguán
Naborot Naborot
@ -7106,7 +7102,6 @@ Nísperos 60
Nóvita Nóvita
Núcleo 138 Núcleo 138
Núñez Núñez
O 184
ONG ONG
ONU ONU
Oasis 101 Oasis 101
@ -7340,7 +7335,6 @@ Ozuluama
Ozumba Ozumba
Ozámiz Ozámiz
Oñate Oñate
P
PEMEX PEMEX
Pabellón 117 Pabellón 117
Pabla Pabla
@ -8519,7 +8513,6 @@ Quiñota
Quíbor Quíbor
Quícharo Quícharo
Quípama Quípama
R
RAE 92 RAE 92
Rabanedo Rabanedo
Rabolargo Rabolargo
@ -8804,7 +8797,6 @@ Rímac 80
Río 159 Río 159
Ríos 139 Ríos 139
Rómulo Rómulo
S
SAT SAT
SEDENA SEDENA
SEP SEP
@ -11117,7 +11109,6 @@ Yáñez
Yécora Yécora
Yésica Yésica
Yólox Yólox
Z
Zaachila Zaachila
Zabache Zabache
Zabaleta Zabaleta

Can't render this file because it is too large.

View file

@ -131,7 +131,7 @@ static def validateDictionaryWord(String word, int lineNumber, String validChara
errors += "${errorMsgPrefix}. Found a garbage word: '${word}' on line ${lineNumber}.\n" errors += "${errorMsgPrefix}. Found a garbage word: '${word}' on line ${lineNumber}.\n"
} }
if (word.matches("^.\$") && !Character.isUpperCase(word.charAt(0))) { if (word.matches("^.\$")) {
errorCount++ errorCount++
errors += "${errorMsgPrefix}. Found a single letter: '${word}' on line ${lineNumber}. Only uppercase single letters are allowed. The rest of the alphabet will be added automatically.\n" errors += "${errorMsgPrefix}. Found a single letter: '${word}' on line ${lineNumber}. Only uppercase single letters are allowed. The rest of the alphabet will be added automatically.\n"
} }

View file

@ -13,7 +13,7 @@
<string name="add_word_add">Add</string> <string name="add_word_add">Add</string>
<string name="add_word_blank">Blank word not added.</string> <string name="add_word_blank">Blank word not added.</string>
<string name="add_word_exist">Word \"%1$s\" already in the dictionary.</string> <string name="add_word_exist">Word \"%1$s\" is already in the dictionary.</string>
<string name="add_word_invalid_language" translatable="false">Cannot add a word when no language is selected.</string> <string name="add_word_invalid_language" translatable="false">Cannot add a word when no language is selected.</string>
<string name="add_word_title">Add Word</string> <string name="add_word_title">Add Word</string>
<string name="add_word_field_placeholder">Type a word…</string> <string name="add_word_field_placeholder">Type a word…</string>

View file

@ -101,15 +101,6 @@ public class DictionaryDb {
} }
public static boolean doesWordExistSync(Language language, String word) {
if (language == null || word == null || word.equals("")) {
return false;
}
return getInstance().wordsDao().doesWordExist(language.getId(), word) > 0;
}
public static void deleteWords(Runnable notification) { public static void deleteWords(Runnable notification) {
deleteWords(notification, null); deleteWords(notification, null);
} }

View file

@ -10,6 +10,7 @@ import java.io.InputStreamReader;
import java.io.LineNumberReader; import java.io.LineNumberReader;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale;
import io.github.sspanak.tt9.ConsumerCompat; import io.github.sspanak.tt9.ConsumerCompat;
import io.github.sspanak.tt9.Logger; import io.github.sspanak.tt9.Logger;
@ -168,11 +169,11 @@ public class DictionaryLoader {
private void importLetters(Language language) { private void importLetters(Language language) {
ArrayList<Word> letters = new ArrayList<>(); ArrayList<Word> letters = new ArrayList<>();
boolean isEnglish = language.getLocale().equals(Locale.ENGLISH);
for (int key = 2; key <= 9; key++) { for (int key = 2; key <= 9; key++) {
for (String langChar : language.getKeyCharacters(key, false)) { for (String langChar : language.getKeyCharacters(key, false)) {
if (DictionaryDb.doesWordExistSync(language, langChar.toUpperCase(language.getLocale()))) { langChar = (isEnglish && langChar.equals("i")) ? langChar.toUpperCase(Locale.ENGLISH) : langChar;
continue;
}
Word word = new Word(); Word word = new Word();
word.langId = language.getId(); word.langId = language.getId();