Overview
Pronunciation dictionaries allow you to customize how specific words or phrases are pronounced in your generated audio. This is particularly useful for:- Technical terms and abbreviations
- Brand names and product names
- Foreign words or names
- Homographs that need different pronunciations based on context
Creating Dictionaries
There are two ways to create pronunciation dictionaries: from rules or from a PLS file.From Rules
Create a dictionary by defining pronunciation rules programmatically:From PLS File
Create a dictionary from a lexicon PLS (Pronunciation Lexicon Specification) file:Rule Types
There are two types of pronunciation rules:Alias Rules
Replace a word or phrase with a different spelling:str
required
The word or phrase to be replaced.
str
required
The replacement text that will be pronounced instead.
bool
default:false
Whether the match should be case-sensitive.
bool
default:true
Whether to only match whole words (not parts of words).
Phoneme Rules
Define pronunciation using phonetic alphabets (IPA or CMU):str
required
The phonetic pronunciation in IPA or CMU format.
str
required
The phonetic alphabet used:
"ipa" or "cmu".Managing Dictionaries
List All Dictionaries
Get Dictionary Details
Retrieve a specific dictionary with all its rules:Update Dictionary Metadata
Update the name or archive status without changing the rules:Download Dictionary
Download a dictionary version as a PLS file:Working with Rules
Once you have a dictionary, you can manage its rules:Add Rules
Remove Rules
Using with Text-to-Speech
Apply pronunciation dictionaries when generating audio:Async Support
All pronunciation dictionary operations support async:Workspace Access
Control who can access your pronunciation dictionaries:str
Access level for workspace members:
"admin"- Full control including deletion"editor"- Can modify and use the dictionary"viewer"- Can only view and use the dictionary- Not provided - No workspace access (private)
Best Practices
Use word boundaries for abbreviations
Use word boundaries for abbreviations
When creating rules for abbreviations like “API” or “AI”, set
word_boundaries=True to avoid replacing these letters within other words.Test pronunciations before production
Test pronunciations before production
Always test your pronunciation rules with sample audio before deploying to production. Different voices may handle the same rules differently.
Version your dictionaries
Version your dictionaries
Dictionaries are versioned automatically when rules change. Keep track of version IDs if you need to reference specific rule sets.
Use descriptive names
Use descriptive names
Give your dictionaries clear, descriptive names and descriptions to make them easy to identify and manage.
Common Use Cases
Technical Documentation
Medical Terminology
Multilingual Content
Next Steps
Async Client
Use pronunciation dictionaries with async operations
Error Handling
Handle errors when working with dictionaries