Lexicon
Source:
src/AWS/Polly/Lexicon.ts
An Amazon Polly pronunciation lexicon — a W3C PLS document stored in a
region that customizes how SynthesizeSpeech pronounces specific words.
Identity is the region-scoped lexiconName; the PLS content is
updatable in place.
Managing Lexicons
Section titled “Managing Lexicons”Store a pronunciation lexicon
const lexicon = yield* AWS.Polly.Lexicon("Acronyms", { lexiconName: "acronyms", content: `<?xml version="1.0" encoding="UTF-8"?><lexicon version="1.0" xmlns="http://www.w3.org/2005/01/pronunciation-lexicon" alphabet="ipa" xml:lang="en-US"> <lexeme><grapheme>W3C</grapheme><alias>World Wide Web Consortium</alias></lexeme></lexicon>`,});Synthesize speech with the lexicon applied
const synthesizeSpeech = yield* AWS.Polly.SynthesizeSpeech();const result = yield* synthesizeSpeech({ OutputFormat: "mp3", VoiceId: "Joanna", Text: "The W3C maintains the PLS standard.", LexiconNames: [lexicon.lexiconName],});