SSML Say-As Guide: Phone Numbers and Ordinals

Speech Synthesis Markup Language (SSML) provides developers with precise control over synthetic speech, resolving ambiguities that standard Text-to-Speech (TTS) engines encounter. The <say-as> tag is an essential SSML element that defines the exact context of text, instructing the voice engine on how to interpret ambiguous characters. This article explains how the <say-as> tag assists TTS engines in correctly vocalizing telephone numbers and ordinal values, transforming raw digits into clear, human-like speech.

The Challenge of Numerical Ambiguity in TTS

By default, TTS engines rely on built-in text normalization algorithms to convert written text into spoken words. When encountering numbers, a TTS engine typically defaults to cardinal values. For example, the string "123" is natively spoken as "one hundred twenty-three."

Without explicit semantic markup, an engine struggles to determine whether a string of digits represents a quantity, a monetary amount, a sequence of individual digits, or a rank. The <say-as> element removes this ambiguity by applying the interpret-as attribute, which explicitly dictates the speech rules the engine must apply.

Pronouncing Telephone Numbers with <say-as>

When a phone number lacks formatting or uses unconventional spacing, a standard TTS engine might attempt to pronounce it as a massive cardinal number or misplace the conversational rhythm.

By applying <say-as interpret-as="telephone">, the developer instructs the engine to process the input according to standard telecommunication conventions:

<speak>
  Please call our support line at 
  <say-as interpret-as="telephone" google:style="zero-as-o">1-800-555-0199</say-as>.
</speak>

Vocalizing Ordinal Values with <say-as>

Ordinal numbers denote position, rank, or sequence (e.g., first, second, third). Written text often presents ordinals ambiguously—either with suffixes like "1st", "2nd", or as plain integers within a list or date context (e.g., "May 4").

Using <say-as interpret-as="ordinal"> guarantees that the TTS engine translates the digit into its ranked verbal form rather than a simple count:

<speak>
  You are the <say-as interpret-as="ordinal">3</say-as> caller in line, 
  and this is your <say-as interpret-as="ordinal">21st</say-as> reminder.
</speak>

Summary

The SSML <say-as> tag bridges the gap between written text and auditory comprehension. By explicitly tagging strings with interpret-as="telephone" and interpret-as="ordinal", developers eliminate TTS pronunciation errors, ensuring automated voice systems deliver clear, professional, and natural-sounding audio.