Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/speech/samples.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,18 @@ en_article item.minecraft.apple The apple en-US-GuyNeural pass en_us
en_wrong_word item.minecraft.apple Pear en-US-JennyNeural fail en_us
en_similar_word item.minecraft.apple Apples en-US-GuyNeural fail en_us
en_wrong_colour block.minecraft.green_wool Red Wool en-US-JennyNeural fail en_us
cs_apple item.minecraft.apple Jablko cs-CZ-AntoninNeural pass cs_cz
cs_dirt block.minecraft.dirt Hlína cs-CZ-VlastaNeural pass cs_cz
cs_stick item.minecraft.stick Tyčka cs-CZ-AntoninNeural pass cs_cz
cs_bread item.minecraft.bread Chléb cs-CZ-VlastaNeural pass cs_cz
cs_torch block.minecraft.torch Louč cs-CZ-AntoninNeural pass cs_cz
cs_pumpkin block.minecraft.pumpkin Dýně cs-CZ-VlastaNeural pass cs_cz
cs_bow item.minecraft.bow Luk cs-CZ-AntoninNeural pass cs_cz
cs_glass block.minecraft.glass Sklo cs-CZ-VlastaNeural pass cs_cz
cs_green_wool block.minecraft.green_wool Zelená vlna cs-CZ-AntoninNeural pass cs_cz
cs_diamond_pickaxe item.minecraft.diamond_pickaxe Diamantový krumpáč cs-CZ-VlastaNeural pass cs_cz
cs_gold_block block.minecraft.gold_block Blok zlata cs-CZ-AntoninNeural pass cs_cz
cs_iron_ingot item.minecraft.iron_ingot Železný ingot cs-CZ-VlastaNeural pass cs_cz
cs_wrong_word item.minecraft.apple Hruška cs-CZ-AntoninNeural fail cs_cz
cs_similar_word item.minecraft.apple Jablka cs-CZ-VlastaNeural fail cs_cz
cs_wrong_colour block.minecraft.green_wool Červená vlna cs-CZ-AntoninNeural fail cs_cz
24 changes: 12 additions & 12 deletions .github/survey/survey.tsv
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Survey of how well Whisper hears item names in languages LangMod might add (.github/workflows/survey.yml).
# Earlier rounds (small model) covered Russian, Dutch, Latin, Tagalog, Japanese, Bosnian, Portuguese, Vietnamese and German. This one: Vietnamese with the medium model.
# Earlier rounds (small model) covered Russian, Dutch, Latin, Tagalog, Japanese, Bosnian, Portuguese, Vietnamese and German, and Vietnamese with the medium model. This one: Czech with the medium model.
# file expected name if the voice says something else (- = the same) text the voice says voice (unused) Whisper language code
vi_apple - Táo vi-VN-NamMinhNeural - vi
vi_dirt - Đất vi-VN-HoaiMyNeural - vi
vi_bread - Bánh mì vi-VN-NamMinhNeural - vi
vi_torch - Đuốc vi-VN-HoaiMyNeural - vi
vi_pumpkin - Bí ngô vi-VN-NamMinhNeural - vi
vi_glass - Thủy tinh vi-VN-HoaiMyNeural - vi
vi_diamond_pickaxe - Cuốc chim kim cương vi-VN-NamMinhNeural - vi
vi_iron_ingot - Phôi sắt vi-VN-HoaiMyNeural - vi
vi_wrong1 Táo Chuối vi-VN-HoaiMyNeural - vi
vi_wrong2 Táo Tào vi-VN-NamMinhNeural - vi
vi_wrong3 Len xanh lá cây Len đỏ vi-VN-HoaiMyNeural - vi
cs_apple - Jablko cs-CZ-AntoninNeural - cs
cs_dirt - Hlína cs-CZ-VlastaNeural - cs
cs_bread - Chléb cs-CZ-AntoninNeural - cs
cs_torch - Louč cs-CZ-VlastaNeural - cs
cs_pumpkin - Dýně cs-CZ-AntoninNeural - cs
cs_glass - Sklo cs-CZ-VlastaNeural - cs
cs_diamond_pickaxe - Diamantový krumpáč cs-CZ-AntoninNeural - cs
cs_iron_ingot - Železný ingot cs-CZ-VlastaNeural - cs
cs_wrong1 Jablko Hruška cs-CZ-AntoninNeural - cs
cs_wrong2 Jablko Jablka cs-CZ-VlastaNeural - cs
cs_wrong3 Zelená vlna Červená vlna cs-CZ-AntoninNeural - cs
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:

The first time you pick up an item, say its name out loud in the language you are learning
(Mandarin Chinese, Spanish, French, Korean, Russian, Dutch, Latin, Tagalog, Japanese, Bosnian,
Portuguese, Vietnamese, German or English). Speech recognition runs on your computer with whisper.cpp;
Portuguese, Vietnamese, German, English or Czech). Speech recognition runs on your computer with whisper.cpp;
nothing is sent anywhere. When learning Korean or English, you can also talk with villagers.

**How to install:** follow [INSTALL.md]($REPO/blob/HEAD/INSTALL.md). In short, you need:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/speech.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
samples: 500
- os: ubuntu-24.04
variants: ctx512,mc512,biased512
languages: ja_jp,bs_ba,pt_br,vi_vn
languages: ja_jp,bs_ba,pt_br,vi_vn,cs_cz
samples: 500
- os: windows-2025
variants: mc512
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ releasing.
Nether and rain. Only the key words count. A wrong answer shows the missing words and the answer
is said out loud; nothing is lost. At most one quiz a minute (adjustable), never during an item
challenge. Works on any server.
- **Czech** can be learned too, with Minecraft's own Czech names (Jablko, Tyčka, Zelená vlna),
so there are 15 languages. Names are checked word by word, and spellings that sound the same
count ("Diamantovi krumpáč", "Chlép"); a different word, a plural or another colour does not.
A Czech Windows voice says the name after a wrong answer.
- New settings: "Quizzes while playing" and "Time between quizzes".

## 0.2.0
Expand Down
3 changes: 2 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ needs a 466 MB model file that isn't included in the mod.
it heard.
5. Choose the language you want to learn: press **Esc**, then **Practice Language**. Mandarin
Chinese is selected at first. You can also pick Spanish, French, Korean, Russian, Dutch, Latin,
Tagalog, Japanese, Bosnian, Portuguese, Vietnamese, German or English.
Tagalog, Japanese, Bosnian, Portuguese, Vietnamese, German, English or Czech.

### How to play

Expand Down Expand Up @@ -106,6 +106,7 @@ English voices, so add the one for your language:
| Vietnamese | Vietnamese |
| German | German (Germany) |
| English | none needed: Windows comes with English voices |
| Czech | Czech |

3. In the game, type `/langmod voices`. It lists the voices it found and which one each language
uses. The volume is Minecraft's **Music & Sounds → Voice/Speech** slider.
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A Fabric mod for Minecraft 26.1.2 that teaches a language through exposure: **Mandarin Chinese**
(Simplified), **Spanish** (Mexico), **French** (Canada), **Korean**, **Russian**, **Dutch**,
**Latin**, **Tagalog**, **Japanese**, **Bosnian**, **Portuguese** (Brazil), **Vietnamese**,
**German** or **English**. The first time you pick up an
**German**, **English** or **Czech**. The first time you pick up an
item type, you have to **say its name out loud** in the language you are learning before you get
it. Get it wrong and a voice says the name for you, so you can hear it and try again. Speech
recognition runs entirely on your computer with [whisper.cpp](https://github.com/ggml-org/whisper.cpp),
Expand Down Expand Up @@ -77,6 +77,7 @@ of the settings screen. You learn one language at a time:
| Vietnamese | `vi_vn` | more than 4 syllables: not challenged | - (the accents are the tones) |
| German | `de_de` | more than 2 words: not challenged | - |
| English | `en_us` | more than 3 words: not challenged | - |
| Czech | `cs_cz` | more than 3 words: not challenged | - |

- The pronunciation under the name (pinyin, romanization, reading) can be hidden with the **Show
pronunciation under names** checkbox in the Practice Language menu, to read the name on its own.
Expand Down Expand Up @@ -141,6 +142,7 @@ An English Windows usually has only English voices, so add the voice of the lang
| Vietnamese | Vietnamese |
| German | German (Germany) |
| English | none: Windows comes with English voices |
| Czech | Czech |

When a language has several voices, pick one with "Voice" in the settings; changing it or "Voice
speed" plays a sample (the word for apple). Japanese names written with kanji are read from their
Expand Down Expand Up @@ -338,7 +340,7 @@ screen. The file can also be edited by hand (then run `/langmod reload`).

| Setting (`langmod.json` key) | Default | Meaning |
|---|---|---|
| Learning (`language`) | `zh_cn` | `zh_cn`, `es_mx`, `fr_ca`, `ko_kr`, `ru_ru`, `nl_nl`, `la_la`, `fil_ph`, `ja_jp`, `bs_ba`, `pt_br`, `vi_vn`, `de_de` or `en_us`, see [Choosing a language](#choosing-a-language). |
| Learning (`language`) | `zh_cn` | `zh_cn`, `es_mx`, `fr_ca`, `ko_kr`, `ru_ru`, `nl_nl`, `la_la`, `fil_ph`, `ja_jp`, `bs_ba`, `pt_br`, `vi_vn`, `de_de`, `en_us` or `cs_cz`, see [Choosing a language](#choosing-a-language). |
| Challenges (`enabled`) | on | Master switch. Turning it off gives held items back. |
| Pronunciation (`showPronunciation`) | on | The pinyin, romanization or reading under names and under what was heard; also the **Show pronunciation under names** checkbox in the Practice Language menu. |
| English name (`showEnglish`) | on | Show the item's name in your game language (usually English) in the popup; left out when it would only repeat the name. |
Expand Down Expand Up @@ -408,7 +410,7 @@ slightly-off pronunciations to the word it expects from context, and sometimes w
same-sounding word with other tones even when you said it right. Tone checking is therefore
helpful but imperfect. If it gets in the way, use `toneless` matching.

### Spanish, French, Russian, Dutch, Latin, Tagalog, Bosnian, Portuguese, German and English
### Spanish, French, Russian, Dutch, Latin, Tagalog, Bosnian, Portuguese, German, English and Czech

Names are compared word by word, and these differences are ignored:

Expand Down Expand Up @@ -437,7 +439,10 @@ Names are compared word by word, and these differences are ignored:
- in German: ß/ss, ä/e, eu/äu, v/f, a final b/d/g said p/t/k ("Brod" for Brot) and an h that only
makes a vowel long; umlauts count, though (Äpfel, the plural, is not Apfel);
- in English: the British spellings of names Minecraft spells the American way ("light grey wool"
for Light Gray Wool, colour, armour).
for Light Gray Wool, colour, armour);
- in Czech: i/y, ů/u, ě said je or ňe ("svjetlo" for Světlo, "mňedi" for mědi), soft d/t/n
before i and ě ("Dýňe" for Dýně), and voiced consonants at the end of a word ("Chlép" for Chléb);
č, š, ž, ř and the soft letters count, though (Červená vlna is not Zelená vlna).

A missing, extra or different word is wrong: "manzanas" for Manzana, "laine vert" for Laine verte
(the t of verte is pronounced), "pan" for Pain (a different nasal vowel), or "яблоки" for Яблоко.
Expand Down Expand Up @@ -646,7 +651,7 @@ of 26.1.2 exist in every one of these languages.

Your own fixes go in `config/langmod/names_<language>.json` (e.g. `names_es_mx.json`, created on
first start, same format); run `/langmod reload` after editing. In the languages added later
(Russian, Dutch, Latin, Tagalog, Japanese, Bosnian, Portuguese, Vietnamese, German), names the
(Russian, Dutch, Latin, Tagalog, Japanese, Bosnian, Portuguese, Vietnamese, German, Czech), names the
translation left in English are left out. The Korean and Russian romanizations are worked out by the mod itself, so they need no
data.

Expand Down
2 changes: 1 addition & 1 deletion THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ projects and keep their own licences.
|---|---|---|
| [pypinyin](https://github.com/mozillazg/python-pinyin) 0.55.0 and its dictionaries | Pinyin readings in `assets/langmod/pinyin/items.json` and `chars.tsv` (generated by `tools/generate_pinyin.py`; pypinyin itself is not shipped) | MIT |
| [SudachiPy](https://github.com/WorksApplications/SudachiPy) 0.7.0 and SudachiDict core | Readings of the Japanese item names in `names/ja_jp_kana.json` (generated by `tools/generate_japanese.py`; neither is shipped) | Apache License 2.0 |
| Minecraft language files (`zh_cn`, `es_mx`, `fr_ca`, `ko_kr`, `ru_ru`, `nl_nl`, `la_la`, `fil_ph`, `ja_jp`, `bs_ba`, `pt_br`, `vi_vn`, `de_de`, `en_us`; Mojang Studios) | The item names in `pinyin/items.json` and `names/*.json` are Minecraft's own translations, looked up by translation key (generated by `tools/generate_pinyin.py` and `tools/generate_names.py`) | Part of Minecraft; used as in any mod that ships vanilla text |
| Minecraft language files (`zh_cn`, `es_mx`, `fr_ca`, `ko_kr`, `ru_ru`, `nl_nl`, `la_la`, `fil_ph`, `ja_jp`, `bs_ba`, `pt_br`, `vi_vn`, `de_de`, `en_us`, `cs_cz`; Mojang Studios) | The item names in `pinyin/items.json` and `names/*.json` are Minecraft's own translations, looked up by translation key (generated by `tools/generate_pinyin.py` and `tools/generate_names.py`) | Part of Minecraft; used as in any mod that ships vanilla text |

## Not bundled

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ static String correct(Language language) {
case VIETNAMESE -> "Chính xác!";
case GERMAN -> "Richtig!";
case ENGLISH -> "Correct!";
case CZECH -> "Správně!";
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ final class ScriptedVoices implements TextToSpeech {
@Override
public List<Voice> voices() {
return List.of(voice("zh-CN"), voice("es-MX"), voice("fr-CA"), voice("ko-KR"), voice("ru-RU"), voice("nl-NL"), voice("it-IT"),
voice("ja-JP"), voice("hr-HR"), voice("pt-BR"), voice("vi-VN"), voice("de-DE"), voice("en-US"));
voice("ja-JP"), voice("hr-HR"), voice("pt-BR"), voice("vi-VN"), voice("de-DE"), voice("en-US"),
voice("cs-CZ"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public enum Language {
PORTUGUESE("pt_br", "pt", "Portuguese (Brazil)", "Português (Brasil)", 3, "skip", "Itens do Minecraft:", true),
VIETNAMESE("vi_vn", "vi", "Vietnamese", "Tiếng Việt", 4, "skip", "Vật phẩm Minecraft:", true),
GERMAN("de_de", "de", "German", "Deutsch", 2, "skip", "Minecraft-Gegenstände:", true),
ENGLISH("en_us", "en", "English", "English", 3, "skip", "Minecraft items:", true);
ENGLISH("en_us", "en", "English", "English", 3, "skip", "Minecraft items:", true),
CZECH("cs_cz", "cs", "Czech", "Čeština", 3, "skip", "Předměty z Minecraftu:", true);

private final String id;
private final String whisperCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

/**
* Languages written with spaces between words (Spanish, French, Russian, Dutch, Latin, Tagalog,
* Bosnian, Portuguese, German, English): names are compared word by word, ignoring case, punctuation,
* apostrophes, accents and an article in front ("la manzana" for Manzana, "l'arc" for Arc). A word
* that is spelled differently but sounds the same still matches (see {@link WordRules#soundKey}),
* and so do words Whisper split or joined differently. Russian names are shown with a
* transliteration.
* Bosnian, Portuguese, German, English, Czech): names are compared word by word, ignoring case,
* punctuation, apostrophes, accents and an article in front ("la manzana" for Manzana, "l'arc" for
* Arc). A word that is spelled differently but sounds the same still matches (see
* {@link WordRules#soundKey}), and so do words Whisper split or joined differently. Russian names
* are shown with a transliteration.
*/
public final class WordPack implements LanguagePack {
private final Language language;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,22 @@ public String soundKey(String word) {
s = s.replaceAll("es$", "is").replaceAll("os$", "us").replaceAll("e$", "i").replaceAll("o$", "u");
return s.replaceAll("(.)\\1+", "$1");
}
},
CZECH(List.of(), List.of("titulky", "titulky vytvořil johnyx", "děkuji za pozornost", "děkuji za zhlédnutí", "odebírejte")) {
@Override
public String soundKey(String word) {
// i/y and u/ů sound the same (vowel length never matters); ě is je after b/p/v/f and ňe after m
// (mě = mně), and d/t/n before ě or i are the soft ď/ť/ň; voiced consonants lose their voice at
// the end of a word (chléb = chlép). č, š, ž, ř, ň, ď and ť stay apart from c, s, z, r, n, d, t.
String s = word.replace("ch", "X").replace("č", "C").replace("š", "S").replace("ž", "Z").replace("ř", "R")
.replace("ň", "N").replace("ď", "D").replace("ť", "T");
s = s.replaceAll("([bpvf])ě", "$1je").replace("mě", "mNe").replaceAll("d(?=[ěií])", "D").replaceAll("t(?=[ěií])", "T")
.replaceAll("n(?=[ěií])", "N");
s = stripAccents(s).replace('y', 'i');
s = s.replaceAll("b$", "p").replaceAll("d$", "t").replaceAll("D$", "T").replaceAll("g$", "k").replaceAll("h$", "X")
.replaceAll("v$", "f").replaceAll("z$", "s").replaceAll("Z$", "S");
return s.replaceAll("(.)\\1+", "$1");
}
};

private final List<String> articles;
Expand All @@ -171,6 +187,7 @@ public static WordRules of(Language language) {
case PORTUGUESE -> PORTUGUESE;
case GERMAN -> GERMAN;
case ENGLISH -> ENGLISH;
case CZECH -> CZECH;
default -> throw new IllegalArgumentException(language + " is not compared word by word");
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ static List<String> locales(Language language) {
case VIETNAMESE -> List.of("vi");
case GERMAN -> List.of("de-DE", "de");
case ENGLISH -> List.of("en-US", "en");
case CZECH -> List.of("cs-CZ", "cs");
};
}

Expand Down
Loading