Setting Date Formats Using the 'date' Attribute of the 'say-as' Tag for Speech Synthesis

, 05-09-2023

The 'date' in SSML is linked to the 'interpret-as' attribute of the 'say-as' tag. It ensures the proper pronunciation of dates. This lets you control how the speech synthesis system interprets and pronounces various date formats.

General Rules

The 'date' functions following the international SSML specification [https://www.w3.org/TR/ssml-sayas/#S3.1].

You can use different separators: a dash "-", a slash "/", or a dot ".".

The 'format' attribute defines the date format, where d = day, m = month, y = year.

Атрибут format задает формат даты, в котором = день, = месяц, = год.

 RangeExample
Day
(1 or 2 digits)
0?[1...9]
[10...31]
03, 15
Month
(1 or 2 digits)
0?[1...9]
[10...12]
7, 11
Year
(1 or 4 digits)
0?0?0?[0...9]
0?0?[10...99]
0?[100..999]
[1000..9999]
45, 998, 2023

Using 0? means that 0 can either be present or not, based on your needs.

For days and months, one or two digits are valid. There's no need to add zeros in front. For years, there's no need to mention the century or leading zeros.

The tag has a default 'detail="1"' value. Keep it as it is.

Possible date formats include: dmy, mdy, ymd, ym, my, md, dm, d, m, y. We'll provide an example for each format.

dmy

<say-as interpret-as="date" format="dmy" detail="1">11-11-2001</say-as>

Example:

 
 
00:03

<say-as interpret-as="date" format="dmy" detail="1">10/5/20</say-as>

Example:

 
 
00:02

mdy

<say-as interpret-as="date" format="mdy" detail="1">05.10.22</say-as>

Example:

 
 
00:02

ymd

<say-as interpret-as="date" format="ymd" detail="1">1969.07.21</say-as>

Example:

 
 
00:04

ym

<say-as interpret-as="date" format="ym" detail="1">1863/07</say-as>

Example:

 
 
00:03

my

<say-as interpret-as="date" format="my" detail="1">8.62</say-as>

Example:

 
 
00:02

md

<say-as interpret-as="date" format="md" detail="1">03/08</say-as>

Example:

 
 
00:02

dm

<say-as interpret-as="date" format="dm" detail="1">5/5</say-as>

Example:

 
 
00:02

d

<say-as interpret-as="date" format="d" detail="1">12</say-as>

Example:

 
 
00:01

m

<say-as interpret-as="date" format="m" detail="1">01</say-as>

Example:

 
 
00:01

y

<say-as interpret-as="date" format="y" detail="1">1492</say-as>

Example:

 
 
00:02

Detail

Using the 'detail' Parameter in Speech Synthesis.

For some voices, the 'detail' parameter determines the sequence of pronouncing the month or day.

For 'detail=1', the neural network will first say the day, then the month, and finally the year. This follows the pattern: "The {ordinal day} of {month}, {year}"

With 'detail=2', the neural network will first say the month, then the day, and finally the year. This pattern is: {month} {ordinal day}, {year}. It's essential to have the day, month, and year when using 'detail='2''.

<say-as interpret-as="date" format="dmy" detail="1">22-11-1963</say-as>

Example:

 
 
00:04

<say-as interpret-as="date" format="dmy" detail="2">22-11-1963</say-as>

Example:

 
 
00:04

Summary

The 'date' parameter in SSML plays a pivotal role in guiding speech synthesis systems on how to interpret and pronounce date formats correctly. Here's a breakdown of its usage and its irreplaceable significance:

  1. Proper Pronunciation: Dates can be represented in numerous formats. For instance, "03/04/2022" can mean March 4th in some regions and April 3rd in others. Using the 'date' parameter ensures that the system pronounces the date in the intended manner, eliminating ambiguity.

  2. Flexibility in Date Formats: The 'date' parameter allows for a wide variety of date formats, from the full "day-month-year" (dmy) to just the year (y). This offers users the flexibility to express dates in the format most suitable for their context.

  3. International Considerations: Different cultures and regions have distinct ways of expressing dates. The 'date' parameter, aligned with the international SSML specification, ensures that synthesized speech can be tailored to a global audience, respecting regional variations.

  4. Adaptable to Context: Depending on the context, leading zeroes, centuries, or specific separators might be unnecessary. The 'date' parameter provides options to adapt date pronunciation as per the situation.

  5. Uniform Interpretation: Especially for applications like virtual assistants, news reading bots, or any AI-driven audio content delivery, ensuring consistent and universally correct pronunciation of dates is critical. The 'date' parameter ensures this uniformity.

When is the 'date' Parameter Irreplaceable?

  • Multilingual Applications: In applications targeting a global audience where multiple languages are in play, the 'date' parameter is essential for correct date pronunciation across different languages.

  • Audiobooks & E-Learning: For content like historical narratives or educational materials where dates play a crucial role, proper pronunciation is non-negotiable. The 'date' parameter ensures clarity.

  • Formal Presentations: In business or academic settings where precision is paramount, any mispronunciation can diminish the credibility of the content. Here, the 'date' parameter is vital.

  • Localized Services: For services like localized news or event announcements, where regional date formats must be respected, the 'date' parameter is indispensable.

In essence, the 'date' parameter in SSML is not just a convenience but often a necessity in ensuring accurate, clear, and culturally sensitive speech synthesis.

 

Support

International Telegram chat @speechgen

Personal support in Telegram @speechgen_alex

E-mails

We use cookies to ensure you get the best experience on our website. Learn more: Privacy Policy

Accept Cookies