Say-as
The <say-as>
tag enables you to control the pronunciation of text, ensuring accurate and natural-sounding responses. This tag is particularly useful when you want to correctly pronounce dates or other specialized text formats.
Attributes of the Say-as Tag
Interpret-as – Specifies how the text should be interpreted:
characters
: Pronounces each character individually (for example, "N-A-S-A").cardinal
: Pronounces text as a cardinal number, for example, "101" as "one hundred and one".date
: Pronounces text as a date, for example, "2023-10-18" as "October eighteenth, twenty twenty-three".digits
: Pronounces each digit individually, for example, "101" as "one zero one".expletive
: Indicates text contains profanity or offensive language.fraction
: Pronounces text as a fraction, for example, "3/4" as "three fourths".letter
: Pronounces text as a letter, for example, "a" as "ay".ordinal
: Pronounces text as an ordinal number, for example, "1st" as "first."spell-out
: Spells out the text, for example, "hello" as "h-e-l-l-o".telephone
: Indicates text is a telephone number, for example, "800-555-1234" as "eight hundred, five five five, one two three four".time
: Pronounces text as a time, for example, "10:00" as "ten o'clock".unit
: Pronounces text as a unit of measurement, for example, "10km" as "ten kilometers".
Format (optinal): Specifies the text format, such as "mdy" for month-day-year, to aid in correct pronunciation. It is optional for some interpretations like
digits
but highly recommended fordate
.
Pronouncing Dates Correctly
It's essential to use the <say-as>
tag for dates. For example, to pronounce "July 4th, 2024" in a natural-sounding American English accent, your SSML code should look like this:
<speak>
Your appointment is on <say-as interpret-as="date" format="mdy">07-04-2024</say-as>.
</speak>
Considerations for Non-English Pronunciations
When dealing with languages that have different grammatical structures, such as German, it's critical to include prepositions within the <say-as>
tag for proper pronunciation. Here's how you can do it:
Incorrect: The bot will mispronounce the date because the preposition "am" is outside the
<say-as>
tag.xmlCopy code<speak> Dein Paket kommt am <say-as interpret-as="date">23-11-2023</say-as>. </speak>
Correct: By including "am" inside the tag, the bot will correctly pronounce the date within the sentence.
xmlCopy code<speak> Dein Paket kommt <say-as interpret-as="date">am 23-11-2023</say-as>. </speak>
This correct structure ensures that the synthesized speech flows naturally and is grammatically accurate in German.
Last updated
Was this helpful?