Prompt
How do I handle pronunciation for names and acronyms in TTS?
Latest observation
Handling pronunciation well in TTS usually means giving the system explicit hints instead of relying on default text reading. The best approach depends on whether the item is a name, an acronym/initialism, or a brand/term.
1) Use a pronunciation lexicon when possible
If your TTS engine supports it, add custom pronunciations in a lexicon (often via SSML, pronunciation dictionaries, or phoneme markup).
- Best for: recurring names, product names, place names
- Pros: consistent, reusable
- Cons: requires maintenance
Example ideas:
"Nguyen"→ “win”"SQL"→ “sequel” or “S-Q-L” depending on context
2) Use SSML pronunciation controls
Common options include:
<phoneme>for exact pronunciation<say-as>for abbreviations, acronyms, dates, numbers, etc.<sub>for substitution/aliasing
Example: acronym
<say-as interpret-as="characters">NASA</say-as>
This tells the TTS to spell it out, if supported.
Example: custom pronunciation
<phoneme alphabet="ipa" ph="ˈnjuːtən">Newton</phoneme>
Example: alias
<sub alias="National Aeronautics and Space Administration">NASA</sub>
3) Decide whether it should be spelled out or spoken as a word
For acronyms, pronunciation often depends on usage:
- Spelled out: FBI, CPU, HTML
- Spoken as a word: NASA, NATO, laser, scuba
If your app knows the item category, apply different rules:
- All-caps and 2–4 letters may often be spelled out, but not always.
- Maintain exceptions like “NASA” and “UNICEF.”
4) For names, use a normalization layer
Names often need:
- transliteration
- alternate spellings
- language-specific rules
Examples:
- “José” should preserve accent-aware pronunciation
- “X Æ A-12” likely needs special handling or user-provided phonetics
- “Siobhan” may need a custom pronunciation entry
A practical workflow:
- Detect if token is a name/acronym
- Check pronunciation dictionary
- Apply SSML or phoneme markup
- Fall back to letter-by-letter or default reading
5) Keep a pronunciation exception list
Store known tricky cases:
- names
- company names
- internal product names
- common acronyms with non-default pronunciation
This is usually the most effective long-term solution.
6) Let users provide preferred pronunciation
If the names come from users, allow them to specify:
- phonetic spelling
- audio sample
- pronunciation in IPA or simplified text
- “spell it out” vs “pronounce as a word”
This is especially important for contact names, onboarding, and accessibility.
7) Test in context
Pronunciation can change based on surrounding words and locale. Test:
- isolated term
- sentence context
- different voices/locales
For example:
- “read” vs “read”
- “US” as “you ess” or “United States”
- “SQL” differently across teams
8) If you can’t control TTS markup, use text tricks carefully
As a fallback:
- insert periods for acronyms:
F.B.I. - use spaces/hyphens for clarity:
X Æ A-12 - respell names phonetically:
Nee-vonfor “Niamh” if needed
Use this sparingly, because it can look odd in the UI.
Practical rule of thumb
- Acronyms: use
say-as, spell out, or a pronunciation dictionary - Names: use custom lexicon or phoneme markup
- Frequent exceptions: maintain a glossary
- User-specific names: allow user-provided pronunciation
If you want, I can also give you:
- a TTS pronunciation strategy by platform (Amazon Polly, Google Cloud TTS, Azure, etc.), or
- a code example using SSML and a pronunciation dictionary.