createPronunciationGuardrail
Create a guardrail that swaps terms for their spoken form before synthesis.
function createPronunciationGuardrail(options): Guardrail;
Defined in: src/guardrails/pronunciation.ts:118
Create a guardrail that swaps terms for their spoken form before synthesis.
Parameters
| Parameter | Type |
|---|---|
options | PronunciationOptions |
Returns
Remarks
Longer terms are matched first, so a dictionary containing both AWS and AWS Lambda applies the more specific entry. Each term then runs in turn over the result of the previous one, so a spoken form that happens to contain another (shorter) dictionary key will itself be rewritten — mapping { PostgreSQL: 'post gres SQL', SQL: 'sequel' } speaks “post gres sequel”. Spell replacements out phonetically to avoid the cascade.
Example
const agent = new CompositeVoice({
providers: [...],
guardrails: {
filters: [
createPronunciationGuardrail({
replacements: {
SQL: 'sequel',
kubectl: 'kube control',
PostgreSQL: 'post-gres-Q-L',
'CI/CD': 'C I C D',
},
}),
],
},
});