Skip to content

fix(normalizer): expand wh-word 're contractions espeak voices as -ray#488

Open
radzrader wants to merge 1 commit into
remsky:masterfrom
radzrader:fix/normalizer-re-contractions
Open

fix(normalizer): expand wh-word 're contractions espeak voices as -ray#488
radzrader wants to merge 1 commit into
remsky:masterfrom
radzrader:fix/normalizer-re-contractions

Conversation

@radzrader

@radzrader radzrader commented Jul 12, 2026

Copy link
Copy Markdown

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 're contractions a spurious stressed
/ɹeɪ/ ("-ray") ending. The clearest example is "how're", which is
phonemized as hˌWɹˌA = /haʊ ɹ eɪ/ — "how-ray", which listeners hear as
"harry". The trailing A is the same /eɪ/ vowel as "day" (dˈA), so the
contraction gets an incorrect diphthong that isn't in the intended word.

This is not voice-specific - it reproduces in both the American (a) and
British (b) pipelines, because it happens in g2p, upstream of the model.

Phonemes (via /dev/phonemize), contracted vs. expanded:

input phonemes reads as
how're you hˌWɹˌA juː "how-ray"
how are you hˌW ɑː juː "how-ah" ✓

The fix

Expand the affected contractions to their two-word form in normalize_text
before 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 already
phonemize correctly are intentionally left untouched, so this changes nothing
for them:

contraction phonemes verdict
you're jɔː correct - left alone
we're wɪə correct - left alone
they're ðɛː correct - left alone
how're hˌWɹˌA broken → how are
what're wˌɒtɹˌA broken → what are
where're wˌɛːɹˌA broken → where are
who're hˌuːɹˌA broken → who are
when're wˌɛnɹˌA broken → when are
why're wˌIɹˌA broken → why are
there're ðɛːɹˌA broken → there are
these're ðiːzɹˌA broken → these are
those're ðQzɹˌA broken → those are

The regex is case-insensitive and preserves the leading word's capitalization
(How'reHow 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-back

01_before_nofix.mp3
02_after_fixed.mp3
03_ab_combined_before_then_after.mp3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant