--- license: mit language: - en - de tags: - g2p - grapheme-to-phoneme - ipa - text-to-speech pretty_name: Crane G2P Test Fixtures --- # G2P Test Fixtures Held-out word-to-IPA test sets for evaluating grapheme-to-phoneme accuracy, used by [Crane](https://github.com/cryptomilk/Crane)'s test suite and benchmarks. These are static test fixtures, not runtime model assets. ## Files | File | Language | Entries | Description | |------|----------|---------|--------------| | `g2p/en_us/test.tsv` | English (US) | 5000 | Held-out word-IPA pairs for CER benchmarking | | `g2p/de_de/test.tsv` | German | 5000 | Held-out word-IPA pairs for CER benchmarking | | `g2p/kokoro_vocab.json` | n/a | 114 | Kokoro phoneme vocabulary (char → token ID) used by the normalizer correctness benchmark | | `g2p/en_us/kokoro_normalizer_ref.tsv` | English (US) | 71 | Raw IPA → expected (`en_us`, Kokoro) normalized IPA + phoneme IDs, for `IpaNormalizer` regression testing | | `g2p/de_de/kokoro_normalizer_ref.tsv` | German | 32 | Raw IPA → expected (`de`, Kokoro) normalized IPA + phoneme IDs, for `IpaNormalizer` regression testing | ## Format `g2p/en_us/test.tsv` and `g2p/de_de/test.tsv`: tab-separated, two columns, UTF-8, no header row, sorted alphabetically: ``` wordIPA ``` Example: ``` abandons əbˈændənz ``` `g2p/en_us/kokoro_normalizer_ref.tsv` and `g2p/de_de/kokoro_normalizer_ref.tsv`: tab-separated, three columns, UTF-8, no header row: ``` raw_ipaexpected_normalized_ipaexpected_phoneme_ids ``` `expected_phoneme_ids` is a comma-separated list of `i64` token IDs, with a `0` (pad/BOS) prepended and appended, matching Moonshine's `phoneme_str_to_input_ids()`. Example: ``` tˈiːtʃɚ tˈiːʧəɹ 0,62,156,51,158,133,83,123,0 ``` `g2p/kokoro_vocab.json`: a flat JSON object mapping each phoneme character to its integer token ID, e.g. `{"a": 43, "ˈ": 156, ...}`. ## Provenance `g2p/en_us/test.tsv` is a 5000-entry random sample (seed 42, no replacement) from Moonshine Voice's (https://github.com/moonshine-ai/moonshine, MIT license) English IPA lexicon, which is itself derived from the CMU Pronouncing Dictionary (https://github.com/cmusphinx/cmudict, BSD-style license). These entries are held out and never seen by the G2P engine during lexicon construction. `g2p/de_de/test.tsv` is a 5000-entry random sample (seed 42, no replacement, one pronunciation per word) from Moonshine Voice's German IPA lexicon (MIT-licensed multilingual IPA dictionary data), deduplicated to unique words before sampling since the source lexicon has multiple pronunciation rows for some words. These entries are held out and never seen by the G2P engine during lexicon construction. `g2p/kokoro_vocab.json` is copied verbatim from Moonshine Voice's `core/moonshine-tts/data/kokoro/config.json` `vocab` object (114 entries; the HuggingFace `onnx-community/Kokoro-82M-v1.0-ONNX` export used by Crane's `kokoro_tts` module has the same 114 entries plus one extra, `$`, which does not affect this normalizer's behavior). `g2p/en_us/kokoro_normalizer_ref.tsv` combines the first 50 lines of Moonshine's own golden English G2P output (`core/moonshine-tts/tests/data/en_us/rule_g2p_wiki_100.txt`) with 21 hand-crafted edge cases (empty/whitespace-only input, each of the 12 diphthong/affricate/rhotic replacements in isolation, unknown-codepoint dropping, non-ASCII whitespace collapsing). Expected output was generated by an independent Python reimplementation of Moonshine's `normalize_ipa_to_kokoro()` and `phoneme_str_to_input_ids()` (`moonshine-tts.cpp`), not by running the C++ itself — the 12 replacement pairs and the vocab-filter/whitespace-collapse logic are simple enough that this port only needs `str.replace`, `str.strip`, and Python's `unicodedata.normalize("NFC", ...)`. `g2p/de_de/kokoro_normalizer_ref.tsv` combines 6 realistic German lexicon entries sampled from `g2p/de_de/test.tsv` (single words plus one 2-word combination, chosen to exercise both plain lexicon passthrough and the affricate/geminate/`ʏ` replacements together with dropped combining diacritics) with 26 hand-crafted edge cases (each `DE_EXTRA_KOKORO_REPLACEMENTS` pair in isolation, shared affricate/diphthong passthrough under `"de"`, German phonemes with no replacement needed, syllabic-consonant and non-syllabic-offglide diacritic dropping, unknown-codepoint dropping, and whitespace handling). Expected output was hand-derived by applying `SHARED_KOKORO_REPLACEMENTS`/`DE_EXTRA_KOKORO_REPLACEMENTS` and the vocab-filter/whitespace-collapse algorithm against `g2p/kokoro_vocab.json` directly, then cross-checked by running the real `IpaNormalizer` and confirming an exact match — not authored by trusting `normalize()`'s own output as ground truth. ## License Both upstream sources use permissive, MIT-compatible licenses: - Moonshine Voice: MIT license. - CMU Pronouncing Dictionary: BSD-style license, Copyright (C) 1993-2015 Carnegie Mellon University. Full text: https://github.com/cmusphinx/cmudict/blob/master/LICENSE