From 215e9257e67539538f5bb165d285631af4bdde2f Mon Sep 17 00:00:00 2001 From: T Duke Perry Date: Thu, 25 Oct 2018 14:50:23 -0400 Subject: [PATCH] Corrected spelling of the word 'romanji' Turns out, I've been spelling 'romanji' completely wrong this entire time. It's actually spelled 'romaji', with no 'n'. So I went through the entire project, correcting every single use of the word, except the historical database schema records used for migration testing, and the current database field names. Because as I explained before (30c55cc1394a3a3977a9ba05b571e1fe8cfed5d2), I don't want to have to write a migration script just for this. Besides, if I was going to change the field names, I'd change 'incorrect_romanji' to 'incorrect_answer', not 'incorrect_romaji'. By the way, the only reason I noticed this was thanks to a YouTube comment (https://www.youtube.com/watch?v=zOwP0KUlnZg&lc=UghRSQOAfU0soXgCoAEC.8VK7CYSCRT88VKGox2Uuob). It's amazing I didn't notice this sooner. Android Studio's spell check would've caught it, but it's a Japanese word, and I didn't install a Japanese dictionary, so I was just adding Japanese words to the custom dictionary instead, not realizing they may be misspelled. I really need to double-check all of this. --- README.md | 2 +- .../kanaquiz/questions/XmlParserTest.java | 8 +- .../kanaquiz/questions/GojuonOrder.java | 90 ++++---- .../kanaquiz/questions/KanaQuestion.java | 40 ++-- .../kanaquiz/questions/WordQuestion.java | 20 +- .../kanaquiz/questions/XmlParser.java | 10 +- app/src/main/res/values/strings.xml | 12 +- app/src/main/res/xml/questions.xsd | 10 +- app/src/main/res/xml/vocabulary.xml | 208 +++++++++--------- 9 files changed, 200 insertions(+), 200 deletions(-) diff --git a/README.md b/README.md index 24cfbc02..c0e3917f 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Currently available on [Google Play™](https://play.google.com/store/apps/detai * Built-in kana reference sheet * Supports both digraphs (ひゃ, みゅ, リュ) and diacritics (が, ぴ) * User can select app behaviour on an incorrect answer from three different options: retry until the correct answer is given, show the correct answer and move on, or hide the correct answer and move on - * Support for the three major romanji systems: Revised Hepburn, Nihon-shiki, and Kunrei-shiki + * Support for the three major romaji systems: Revised Hepburn, Nihon-shiki, and Kunrei-shiki * A daily log will show your progress over time * Dynamic AI chooses the kana you have the most trouble with diff --git a/app/src/androidTest/java/com/noprestige/kanaquiz/questions/XmlParserTest.java b/app/src/androidTest/java/com/noprestige/kanaquiz/questions/XmlParserTest.java index 1365113b..48c0a8f2 100644 --- a/app/src/androidTest/java/com/noprestige/kanaquiz/questions/XmlParserTest.java +++ b/app/src/androidTest/java/com/noprestige/kanaquiz/questions/XmlParserTest.java @@ -70,8 +70,8 @@ public void parsingTest() assertKanaQuestion(kanaSetList.get(2)[NO_DIACRITIC.ordinal()][0][0], "は", "ha"); assertKanaQuestion(kanaSetList.get(2)[NO_DIACRITIC.ordinal()][0][1], "ひ", "hi"); assertKanaQuestion(kanaSetList.get(2)[NO_DIACRITIC.ordinal()][0][2], "ふ", "fu"); - assertThat(((KanaQuestion) kanaSetList.get(2)[NO_DIACRITIC.ordinal()][0][2]).fetchRomanji(NIHON), is("hu")); - assertThat(((KanaQuestion) kanaSetList.get(2)[NO_DIACRITIC.ordinal()][0][2]).fetchRomanji(KUNREI), is("hu")); + assertThat(((KanaQuestion) kanaSetList.get(2)[NO_DIACRITIC.ordinal()][0][2]).fetchRomaji(NIHON), is("hu")); + assertThat(((KanaQuestion) kanaSetList.get(2)[NO_DIACRITIC.ordinal()][0][2]).fetchRomaji(KUNREI), is("hu")); assertKanaQuestion(kanaSetList.get(2)[NO_DIACRITIC.ordinal()][0][3], "へ", "he"); assertKanaQuestion(kanaSetList.get(2)[NO_DIACRITIC.ordinal()][0][4], "ほ", "ho"); @@ -102,9 +102,9 @@ public void parsingTest() assertKanaQuestion(kanaSetList.get(2)[CONSONANT.ordinal()][0][0], "ん", "n"); } - private void assertKanaQuestion(Question question, String expectedKana, String expectedRomanji) + private void assertKanaQuestion(Question question, String expectedKana, String expectedRomaji) { assertThat(question.getQuestionText(), is(expectedKana)); - assertThat(((KanaQuestion) question).fetchRomanji(null), is(expectedRomanji)); + assertThat(((KanaQuestion) question).fetchRomaji(null), is(expectedRomaji)); } } diff --git a/app/src/main/java/com/noprestige/kanaquiz/questions/GojuonOrder.java b/app/src/main/java/com/noprestige/kanaquiz/questions/GojuonOrder.java index e1b149fa..2c45ea9e 100644 --- a/app/src/main/java/com/noprestige/kanaquiz/questions/GojuonOrder.java +++ b/app/src/main/java/com/noprestige/kanaquiz/questions/GojuonOrder.java @@ -7,30 +7,30 @@ public class GojuonOrder implements Comparator { - static class NotRomanjiException extends Exception {} + static class NotRomajiException extends Exception {} - static void sort(String[] romanji) + static void sort(String[] romaji) { - Arrays.sort(romanji, new GojuonOrder()); + Arrays.sort(romaji, new GojuonOrder()); } - private static int getSortId(CharacterIterator romanji) + private static int getSortId(CharacterIterator romaji) { - int startIndex = romanji.getIndex(); + int startIndex = romaji.getIndex(); try { - return getRomanjiKey(romanji); + return getRomajiKey(romaji); } - catch (NotRomanjiException ex) + catch (NotRomajiException ex) { - if (romanji.setIndex(startIndex) == 'n') + if (romaji.setIndex(startIndex) == 'n') return 108; //N Consonant else - return 109 + romanji.current(); + return 109 + romaji.current(); } finally { - romanji.next(); + romaji.next(); } } @@ -38,67 +38,67 @@ private static int getSortId(CharacterIterator romanji) private static final char[] MAIN_SETS = {'k', 'g', '\u0000', 'z', '\u0000', 'd', 'n', 'h', 'b', 'p', 'm'}; private static final char[] Y_VOWELS = {'a', 'u', 'o'}; - private static int getRomanjiKey(CharacterIterator romanji) throws NotRomanjiException + private static int getRomajiKey(CharacterIterator romaji) throws NotRomajiException { for (int i = 0; i < VOWELS.length; i++) - if (romanji.current() == VOWELS[i]) + if (romaji.current() == VOWELS[i]) return i; for (int i = 0; i < MAIN_SETS.length; i++) - if (romanji.current() == MAIN_SETS[i]) - return 5 + (i * 8) + getSubKey(romanji); + if (romaji.current() == MAIN_SETS[i]) + return 5 + (i * 8) + getSubKey(romaji); - switch (romanji.current()) + switch (romaji.current()) { case ' ': case CharacterIterator.DONE: return -1; case 's': - if (romanji.next() == 'h') - return 21 + getAltIKey(romanji); + if (romaji.next() == 'h') + return 21 + getAltIKey(romaji); else { - romanji.previous(); - return 21 + getSubKey(romanji); + romaji.previous(); + return 21 + getSubKey(romaji); } case 'j': - return 29 + getAltIKey(romanji); + return 29 + getAltIKey(romaji); case 't': - if (romanji.next() == 's') + if (romaji.next() == 's') { - if (romanji.next() == 'u') + if (romaji.next() == 'u') return 37 + 2; else break; } else { - romanji.previous(); - return 37 + getSubKey(romanji); + romaji.previous(); + return 37 + getSubKey(romaji); } case 'c': - if (romanji.next() == 'h') - return 37 + getAltIKey(romanji); + if (romaji.next() == 'h') + return 37 + getAltIKey(romaji); else break; case 'f': - if (romanji.next() == 'u') + if (romaji.next() == 'u') return 61 + 2; else break; case 'y': - romanji.next(); - return 93 + getYVowelKey(romanji); + romaji.next(); + return 93 + getYVowelKey(romaji); case 'r': - return 96 + getSubKey(romanji); + return 96 + getSubKey(romaji); case 'w': - switch (romanji.next()) + switch (romaji.next()) { case 'a': return 104; @@ -111,39 +111,39 @@ private static int getRomanjiKey(CharacterIterator romanji) throws NotRomanjiExc } break; } - throw new NotRomanjiException(); + throw new NotRomajiException(); } - private static int getSubKey(CharacterIterator romanji) throws NotRomanjiException + private static int getSubKey(CharacterIterator romaji) throws NotRomajiException { - romanji.next(); + romaji.next(); for (int i = 0; i < VOWELS.length; i++) - if (romanji.current() == VOWELS[i]) + if (romaji.current() == VOWELS[i]) return i; - if (romanji.current() == 'y') + if (romaji.current() == 'y') { - romanji.next(); - return 5 + getYVowelKey(romanji); + romaji.next(); + return 5 + getYVowelKey(romaji); } - throw new NotRomanjiException(); + throw new NotRomajiException(); } - private static int getAltIKey(CharacterIterator romanji) throws NotRomanjiException + private static int getAltIKey(CharacterIterator romaji) throws NotRomajiException { - if (romanji.next() == 'i') + if (romaji.next() == 'i') return 1; - return 5 + getYVowelKey(romanji); + return 5 + getYVowelKey(romaji); } - private static int getYVowelKey(CharacterIterator romanji) throws NotRomanjiException + private static int getYVowelKey(CharacterIterator romaji) throws NotRomajiException { for (int i = 0; i < Y_VOWELS.length; i++) - if (romanji.current() == Y_VOWELS[i]) + if (romaji.current() == Y_VOWELS[i]) return i; - throw new NotRomanjiException(); + throw new NotRomajiException(); } @Override diff --git a/app/src/main/java/com/noprestige/kanaquiz/questions/KanaQuestion.java b/app/src/main/java/com/noprestige/kanaquiz/questions/KanaQuestion.java index d883e4a2..52583f1b 100644 --- a/app/src/main/java/com/noprestige/kanaquiz/questions/KanaQuestion.java +++ b/app/src/main/java/com/noprestige/kanaquiz/questions/KanaQuestion.java @@ -12,19 +12,19 @@ public class KanaQuestion extends Question { private final String kana; - private final String defaultRomanji; - private final Map altRomanji; + private final String defaultRomaji; + private final Map altRomaji; - KanaQuestion(String kana, String romanji) + KanaQuestion(String kana, String romaji) { - this(kana, romanji, null); + this(kana, romaji, null); } - KanaQuestion(String kana, String romanji, Map altRomanji) + KanaQuestion(String kana, String romaji, Map altRomaji) { this.kana = kana.trim(); - defaultRomanji = romanji.trim(); - this.altRomanji = altRomanji; + defaultRomaji = romaji.trim(); + this.altRomaji = altRomaji; } String getQuestionText() @@ -34,10 +34,10 @@ String getQuestionText() boolean checkAnswer(String response) { - if (defaultRomanji.trim().equalsIgnoreCase(response.trim())) + if (defaultRomaji.trim().equalsIgnoreCase(response.trim())) return true; - if (altRomanji != null) - for (String correctAnswer : altRomanji.values()) + if (altRomaji != null) + for (String correctAnswer : altRomaji.values()) if (correctAnswer.trim().equalsIgnoreCase(response.trim())) return true; @@ -46,28 +46,28 @@ boolean checkAnswer(String response) String fetchCorrectAnswer() { - return fetchRomanji(); + return fetchRomaji(); } - String fetchRomanji() + String fetchRomaji() { if (OptionsControl.compareStrings(R.string.prefid_romanize_system, R.string.prefid_romanize_system_default)) - return defaultRomanji; + return defaultRomaji; else if (OptionsControl .compareStrings(R.string.prefid_romanize_system, R.string.prefid_romanize_system_hepburn)) - return fetchRomanji(RomanizationSystem.HEPBURN); + return fetchRomaji(RomanizationSystem.HEPBURN); else if (OptionsControl.compareStrings(R.string.prefid_romanize_system, R.string.prefid_romanize_system_nihon)) - return fetchRomanji(RomanizationSystem.NIHON); + return fetchRomaji(RomanizationSystem.NIHON); else if (OptionsControl.compareStrings(R.string.prefid_romanize_system, R.string.prefid_romanize_system_kunrei)) - return fetchRomanji(RomanizationSystem.KUNREI); + return fetchRomaji(RomanizationSystem.KUNREI); else - return defaultRomanji; + return defaultRomaji; } - String fetchRomanji(RomanizationSystem system) + String fetchRomaji(RomanizationSystem system) { - String romanji = (((system == null) || (altRomanji == null)) ? null : altRomanji.get(system)); - return (romanji == null) ? defaultRomanji : romanji; + String romaji = (((system == null) || (altRomaji == null)) ? null : altRomaji.get(system)); + return (romaji == null) ? defaultRomaji : romaji; } @Override diff --git a/app/src/main/java/com/noprestige/kanaquiz/questions/WordQuestion.java b/app/src/main/java/com/noprestige/kanaquiz/questions/WordQuestion.java index 25102fbe..ab94b88b 100644 --- a/app/src/main/java/com/noprestige/kanaquiz/questions/WordQuestion.java +++ b/app/src/main/java/com/noprestige/kanaquiz/questions/WordQuestion.java @@ -9,14 +9,14 @@ public class WordQuestion extends Question { - private final String romanji; + private final String romaji; private final String kana; private final String kanji; private final String answer; - public WordQuestion(String romanji, String answer, String kana, String kanji) + public WordQuestion(String romaji, String answer, String kana, String kanji) { - this.romanji = romanji.trim(); + this.romaji = romaji.trim(); this.answer = answer.trim(); this.kana = (kana != null) ? kana.trim() : null; this.kanji = (kanji != null) ? kanji.trim() : null; @@ -24,7 +24,7 @@ public WordQuestion(String romanji, String answer, String kana, String kanji) enum QuestionTextType { - ROMANJI, + ROMAJI, KANA, KANJI } @@ -32,14 +32,14 @@ enum QuestionTextType @Override String getQuestionText() { - if (OptionsControl.compareStrings(R.string.prefid_vocab_display, R.string.prefid_vocab_display_romanji)) - return fetchText(QuestionTextType.ROMANJI); + if (OptionsControl.compareStrings(R.string.prefid_vocab_display, R.string.prefid_vocab_display_romaji)) + return fetchText(QuestionTextType.ROMAJI); else if (OptionsControl.compareStrings(R.string.prefid_vocab_display, R.string.prefid_vocab_display_kana)) return fetchText(QuestionTextType.KANA); else if (OptionsControl.compareStrings(R.string.prefid_vocab_display, R.string.prefid_vocab_display_kanji)) return fetchText(QuestionTextType.KANJI); else - return romanji; + return romaji; } @SuppressWarnings("fallthrough") @@ -53,9 +53,9 @@ private String fetchText(QuestionTextType type) case KANA: if (kana != null) return kana; - case ROMANJI: + case ROMAJI: default: - return romanji; + return romaji; } } @@ -74,7 +74,7 @@ String fetchCorrectAnswer() @Override String getDatabaseKey() { - return romanji; + return romaji; } @Override diff --git a/app/src/main/java/com/noprestige/kanaquiz/questions/XmlParser.java b/app/src/main/java/com/noprestige/kanaquiz/questions/XmlParser.java index 651e3c04..104824da 100644 --- a/app/src/main/java/com/noprestige/kanaquiz/questions/XmlParser.java +++ b/app/src/main/java/com/noprestige/kanaquiz/questions/XmlParser.java @@ -182,7 +182,7 @@ private static KanaQuestion parseXmlKanaQuestion(XmlResourceParser parser, Resou private static WordQuestion parseXmlWordQuestion(XmlResourceParser parser, Resources resources) throws ParseException { - String thisRomanji = null; + String thisRomaji = null; String thisKana = null; String thisKanji = null; String thisAnswer = null; @@ -190,8 +190,8 @@ private static WordQuestion parseXmlWordQuestion(XmlResourceParser parser, Resou { switch (parser.getAttributeName(i)) { - case "romanji": - thisRomanji = parseXmlValue(parser, i, resources); + case "romaji": + thisRomaji = parseXmlValue(parser, i, resources); break; case "kana": thisKana = parseXmlValue(parser, i, resources); @@ -203,10 +203,10 @@ private static WordQuestion parseXmlWordQuestion(XmlResourceParser parser, Resou thisAnswer = parseXmlValue(parser, i, resources); } } - if ((thisRomanji == null) || (thisAnswer == null)) + if ((thisRomaji == null) || (thisAnswer == null)) throw new ParseException("Missing attribute in WordQuestion", 0); - return new WordQuestion(thisRomanji, thisAnswer, thisKana, thisKanji); + return new WordQuestion(thisRomaji, thisAnswer, thisKana, thisKanji); } private static TreeMap parseXmlAltAnswers(XmlPullParser parser) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5563eaa6..97f09f12 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -14,8 +14,8 @@ No Questions available Correct Incorrect - Enter the Romanji equivalent - Select the Romanji equivalent + Enter the Romaji equivalent + Select the Romaji equivalent Enter the English translation Select the English translation Try again @@ -103,22 +103,22 @@ Preferred Vocabulary Question Format Which character set should be used for vocabulary questions - Romanji + Romaji Hiragana/Katakana Kanji vocab_display - romanji + romaji kana kanji - @string/vocab_display_option_romanji + @string/vocab_display_option_romaji @string/vocab_display_option_kana @string/vocab_display_option_kanji - @string/prefid_vocab_display_romanji + @string/prefid_vocab_display_romaji @string/prefid_vocab_display_kana @string/prefid_vocab_display_kanji diff --git a/app/src/main/res/xml/questions.xsd b/app/src/main/res/xml/questions.xsd index 68a9e520..3ebf5b42 100644 --- a/app/src/main/res/xml/questions.xsd +++ b/app/src/main/res/xml/questions.xsd @@ -21,7 +21,7 @@ - + @@ -74,13 +74,13 @@ - + - + @@ -90,7 +90,7 @@ - + @@ -132,7 +132,7 @@ - + diff --git a/app/src/main/res/xml/vocabulary.xml b/app/src/main/res/xml/vocabulary.xml index 97d9691e..cbabc99f 100644 --- a/app/src/main/res/xml/vocabulary.xml +++ b/app/src/main/res/xml/vocabulary.xml @@ -4,141 +4,141 @@ xsi:schemaLocation="https://www.noprestige.com questions.xsd"> - - - - + + + + - - - - - - + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + +