German API

German G2P provides phoneme conversion using a large 738k+ entry dictionary with rule-based fallback.

German semantic normalization is provided by spokenform and runs once per homogeneous language run before token-local G2P processing. In the public default span pipeline, spokenform source replacements are rebased to original document offsets and merged into semantic token spans before token-local expansion. This keeps numeric context intact for grouped numbers (1.000), decimals (3,14), EUR amounts, dates, times, temperatures, ordinals, and numbered units with singular/plural agreement, including when the backend has no language-owned normalizer. Unit symbols are context bound: 2 kg becomes zwei Kilogramm, while a standalone kg is preserved. Dotted numeric aliases such as 1 ltr. and 45 Min. are consumed as part of the semantic span, so their periods are not treated as independent sentence punctuation. Min. is intentionally numeric-only: standalone Min. Beispiel remains unchanged, while 1 Min. becomes eine Minute. Invalid dates/times and ambiguous punctuation are left unchanged. Flexible z.B., d.h., and u.a. spellings are supported through the bounded Spokenform 0.2.x and abbr2words profiles. Accepted semantic replacements are not rewritten by kokorog2p; only German G2P typography remains local.

GermanNormalizer remains available as a compatibility facade for direct callers. Its semantic result is backed by spokenform, while G2P-specific German typography remains local. Abbreviation customization continues to use the shared abbr2words registry.

Main Class

Lexicon

Number Conversion

Examples

from kokorog2p.de import GermanG2P

g2p = GermanG2P(language="de-de")
tokens = g2p("Guten Tag, wie geht es Ihnen?")

for token in tokens:
    print(f"{token.text} -> {token.phonemes}")