Skip to content

Commit f924fce

Browse files
committed
feat(zonos,#435): built-in G2P is now the default for en/de/fr — no espeak needed
espeak-ng is GPL-3.0. For the three languages where the built-in G2P was MEASURED to be as good or better, zonos no longer reaches for it at all. Flipped only on evidence, per language, from chr1s4/crispasr-zonos-g2p-435 with espeak physically removed and the removal verified: en ASR word-F1 1.00 vs espeak 1.00, 0 dropped symbols de 1.00 vs 1.00, 0 dropped, transcripts byte-identical fr 0.95 vs espeak 0.84 -- the built-in is BETTER (`renard` vs `renarbre`) es is deliberately NOT flipped. Its built-in scored 0.81 against an espeak BASELINE of 0.57, so the higher number is absence of evidence of harm, not proof of parity -- and the two spell the trill differently (espeak `ɾɾ`, built-in `r`) while BOTH symbols are in zonos's inventory, so the drop counter cannot see it. Everything else, ru included, has no built-in and keeps espeak. CRISPASR_ZONOS_G2P=espeak restores the previous order exactly. Selector verified to pick exactly the intended set: en-us/en-gb/de/fr-fr/fr-be yes; es/es-419/ru/ja no; and ben/ven/wen NO -- the substring match that used to route Bengali, Venda and Sorbian into the English G2P is gone.
1 parent f1df31f commit f924fce

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

src/zonos_tts.cpp

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,33 @@ static const char* g2p_mode_name(g2p_mode m) {
10821082
}
10831083
}
10841084

1085+
// Languages where the BUILT-IN G2P is the default ahead of espeak.
1086+
//
1087+
// Only what was measured, per language, on chr1s4/crispasr-zonos-g2p-435 with
1088+
// espeak physically removed and the removal verified:
1089+
//
1090+
// en ASR word-F1 1.00 vs espeak 1.00, 0 dropped symbols
1091+
// de 1.00 vs 1.00, 0 dropped, transcripts byte-identical
1092+
// fr 0.95 vs espeak's 0.84 -- the built-in is BETTER here
1093+
// (`renard`, where espeak says `renarbre`)
1094+
//
1095+
// es is deliberately NOT here. Its built-in scored 0.81 against an espeak
1096+
// BASELINE of only 0.57, so the higher number is absence of evidence of harm,
1097+
// not proof of parity -- and the two spell the trill differently (espeak `ɾɾ`,
1098+
// built-in `r`) while BOTH symbols are in zonos's inventory, so the drop
1099+
// counter is blind to it by construction. Everything else (ru included) has no
1100+
// built-in at all and must keep espeak.
1101+
//
1102+
// The point of the flip is the LICENCE: espeak-ng is GPL-3.0 and the built-in
1103+
// G2P is not, so for these three languages zonos no longer needs it at all.
1104+
// CRISPASR_ZONOS_G2P=espeak restores the old order exactly.
1105+
static bool builtin_is_default_for(const std::string& lang) {
1106+
const char* prim = crispasr::builtin_g2p_language(lang);
1107+
if (!prim || !*prim)
1108+
return false;
1109+
return std::strcmp(prim, "en") == 0 || std::strcmp(prim, "de") == 0 || std::strcmp(prim, "fr") == 0;
1110+
}
1111+
10851112
// Built-in (non-GPL) G2P for the languages crispasr-core covers: en/de/fr/es.
10861113
// Punctuation is carried through, matching the Python reference's
10871114
// `preserve_punctuation=True`, so the tail-punctuation compensation the espeak
@@ -1157,7 +1184,9 @@ static std::vector<int32_t> tokenize_text_full(const char* text, const char* lan
11571184

11581185
std::string ipa;
11591186

1160-
if (mode == g2p_mode::builtin_first && phonemize_builtin_zonos(l, text, ipa))
1187+
const bool builtin_leads =
1188+
mode == g2p_mode::builtin_first || (mode == g2p_mode::automatic && builtin_is_default_for(l));
1189+
if (builtin_leads && phonemize_builtin_zonos(l, text, ipa))
11611190
return finish("builtin", ipa);
11621191

11631192
if (phonemize_espeak_inproc(l, text, ipa) && !ipa.empty())

0 commit comments

Comments
 (0)