fix(normalizer): expand wh-word 're contractions espeak voices as -ray#488
Open
radzrader wants to merge 1 commit into
Open
fix(normalizer): expand wh-word 're contractions espeak voices as -ray#488radzrader wants to merge 1 commit into
radzrader wants to merge 1 commit into
Conversation
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.
AI assisted (Opus 4.8) but tested in my own running version on my GB10 Spark.
Description
The bug
espeak's letter-to-sound gives some
'recontractions a spurious stressed/ɹeɪ/("-ray") ending. The clearest example is "how're", which isphonemized as
hˌWɹˌA= /haʊ ɹ eɪ/ — "how-ray", which listeners hear as"harry". The trailing
Ais the same/eɪ/vowel as "day" (dˈA), so thecontraction gets an incorrect diphthong that isn't in the intended word.
This is not voice-specific - it reproduces in both the American (
a) andBritish (
b) pipelines, because it happens in g2p, upstream of the model.Phonemes (via
/dev/phonemize), contracted vs. expanded:how're youhˌWɹˌA juːhow are youhˌW ɑː juːThe fix
Expand the affected contractions to their two-word form in
normalize_textbefore phonemization. This sits alongside the normalizer's existing always-on
English fixups (
Dr.→"Doctor",yeah→"ye'a", etc.).The list is deliberately limited to the contractions that actually break -
the wh-words plus
there/these/those. Common contractions that alreadyphonemize correctly are intentionally left untouched, so this changes nothing
for them:
you'rejɔːwe'rewɪəthey'reðɛːhow'rehˌWɹˌAhow arewhat'rewˌɒtɹˌAwhat arewhere'rewˌɛːɹˌAwhere arewho'rehˌuːɹˌAwho arewhen'rewˌɛnɹˌAwhen arewhy'rewˌIɹˌAwhy arethere'reðɛːɹˌAthere arethese'reðiːzɹˌAthese arethose'reðQzɹˌAthose areThe regex is case-insensitive and preserves the leading word's capitalization
(
How're→How are), and matches both the straight (') and typographic(
’) apostrophe.Audio (before / after)
Same sentence,
bf_emma, listen to "how're":01_before_nofix.mp3— this codebase, normalization off (bug) → "harry"02_after_fixed.mp3— this codebase, with this fix → "how are"03_ab_combined_before_then_after.mp3— both back-to-back01_before_nofix.mp3
02_after_fixed.mp3
03_ab_combined_before_then_after.mp3