Implement text analysis solutions 4.2 Implement speech solutions

A voice agent that uses Azure Speech text to speech mispronounces about 300 product names…

Study guide skill: Implement workflows to convert speech to text and text to speech for agentic interactions

Question B3-024

A voice agent that uses Azure Speech text to speech mispronounces about 300 product names and medical terms. You want to define the pronunciations in one place and apply them to everything the agent says. What should you use?

Select one answer.

  • A The Long Audio API, which applies lexicon files automatically
  • B A phoneme element around every occurrence of each term in every response
  • C A custom speech model trained on recordings of the terms
  • D A custom lexicon file, referenced from SSML with the lexicon element ✓ Correct answer

Answer: D

The phoneme and sub elements define how single entities are read, but to define how many entities are read you create an XML custom lexicon file and reference it from SSML. Wrapping every occurrence in phoneme elements doesn't give you one place to maintain hundreds of terms. Custom speech improves speech recognition (speech to text), not synthesis, and the lexicon element isn't supported by the Long Audio API.

Deep dive

How it works

Azure Speech text to speech gives you two levels of pronunciation control in SSML:

  • For single entities, such as a company name, a medical term or an emoji, use the phoneme and sub elements inline.
  • For multiple entities, create an XML custom lexicon file, upload it, and reference it from SSML with the lexicon element.

With about 300 terms, the lexicon is the "one place" the question asks for. You maintain every pronunciation in a single file that follows the Pronunciation Lexicon Specification (PLS), and each SSML document just points to it:

  1. Write the lexicon file (.xml or .pls) with an entry for each term.
  2. Publish it at a URI. Azure Blob Storage is recommended, and you can use a SAS URL if you don't want the file to be public.
  3. Add a lexicon element with that uri inside the voice element of your SSML.

Every response the agent synthesizes then picks up the same pronunciations. When a term changes, you edit the file, not your prompts or code. If you still need one-off fixes, the phoneme element gives phonetic spellings using alphabets like ipa, sapi, ups or x-sampa. Always include human-readable text as a fallback.

The other options, and when you'd use them

  • The Long Audio API, which applies lexicon files automatically: The docs say the opposite. The lexicon element isn't supported by the Long Audio API, and for long-form text to speech you'd use the batch synthesis API instead.
  • A phoneme element around every occurrence: Phoneme elements are meant for single entities. Wrapping hundreds of terms everywhere they appear gives you no single place to maintain them and is easy to get wrong.
  • A custom speech model trained on recordings: Custom speech improves the accuracy of speech recognition (speech to text). It doesn't change how synthesized speech pronounces words.

Exam tip

"A few words" means phoneme or sub inline. "Hundreds of terms, defined once" means a custom lexicon referenced with the lexicon element. Custom speech is for recognition, not synthesis.

References

Last reviewed:

Ready to test yourself? The quiz asks this and every other AI-103 question, with instant feedback. Practice this in a quiz →

All Text analysis questions · AI-103 study guide

Thanks for your feedback!