feat: add German G2P with text normalization#97
Open
semidark wants to merge 2 commits into
Open
Conversation
Add misaki/de.py with: - normalize_text_de(): expands numbers, dates, times, currency, abbreviations, ordinals, and years to spelled-out German text - DEG2P: wraps normalize_text_de() + EspeakG2P(language='de') Normalizer handles: - Cardinal numbers (zweiundvierzig), ordinals (dritte) - Years (neunzehnhundertfünfundachtzig) - Dates DD.MM.YYYY, times HH:MM - Currency (Euro, Dollar, Pfund, Yen with cents) - 30+ German abbreviations (Dr., GmbH, z.B., usw., months) - German-format numbers (1.234,56 with thousand dots + decimal comma) - Quote normalization, whitespace cleanup Add tests/test_de.py with 60 unit tests (CI-safe, no espeak needed) and 4 integration tests (skipped when phonemizer unavailable). Add 'de' optional dependency in pyproject.toml.
'14:30 Uhr' was normalized to 'vierzehn Uhr dreißig Uhr'. Now the regex optionally consumes trailing ' Uhr' after HH:MM.
This was referenced Apr 17, 2026
|
I found a few small German-normalizer edge cases while testing this PR and opened a follow-up against your branch here: semidark#1 It covers:
Verification:
I also noticed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add German G2P module (
misaki/de.py) with text normalization and espeak-ng phonemization.Changes
misaki/de.py:DEG2Pclass +normalize_text_de()functiontests/test_de.py: 61 unit tests (CI-safe, no espeak needed) + 4 integration testspyproject.toml: adddeoptional dependencyWhat
normalize_text_de()handles42->zweiundvierzig)3.->dritte)1985->neunzehnhundertfünfundachtzig)24.12.2024->vierundzwanzigste Dezember zweitausendvierundzwanzig)14:30->vierzehn Uhr dreißig)€29,99->neunundzwanzig Euro und neunundneunzig Cent)Dr.,GmbH,z.B.,usw., months, etc.)1.234,56with thousand dots + decimal comma)Architecture
DEG2Pfollows the same pattern asKOG2P(Korean) andHEG2P(Hebrew):The deferred import allows
normalize_text_de()to be tested without phonemizer installed.Usage
Context
This module was developed as part of kokoro-deutsch, a community project for fine-tuning Kokoro for German. A trained German multi-speaker base model is published at dida-80b/kokoro-deutsch-hui-base.
No new heavy dependencies are introduced. The
deextra only addsphonemizer-forkandespeakng-loader, which are already used bymisaki[en].