English Context tag definitions
The CONTEXT tag specifies the normalization of a block of text. This specification defines the SAPI predefined attributes (ID) for the CONTEXT tag. These IDs are strings. SAPI does not perform any parameter validation on the string passed to the engine, hence, the application can specify engine-specific normalization IDs to the engine. Engine-specific strings begin with the engine vendor's name to avoid confusion between engines.
For example:
<CONTEXT ID = "MS_My_Context"> text </CONTEXT>
The exact implementation of some of these values is dependent on the engine used in SAPI 5. In order to force a certain normalization, application developers can choose to normalize the text, or use another SAPI tag or engine-specific ID. Each context tag can contain more than one string.
For example:
<CONTEXT ID = "date_mdy"> 12/21/99 11/21/99 10/21/99 </CONTEXT> would be normalized to "December twenty first nineteen ninety nine November twenty first nineteen ninety nine October twenty first nineteen ninety nine."
The following predefined context types are covered in this section:
Date
This context specifies that the number passed to the engine is a date. Dates will generally have the format of number [delimiter] number [delimiter] number or number [delimiter] number where the delimiter can be a '.', '/' or '-', and numbers are typically between 01 and 12 for months, 01 and 31 for days. A year is generally a two or four-digit number.
The following are valid string types:
- date_mdy
- This will normalize the date so that the first group of numbers is the month, the second group is the day, and the third group is the year. In the case where the year is a two-digit number, the engine reads it as a two-digit number or a four-digit number.
For example:
<context ID = "date_mdy">12/21/99</context>
will be normalized to "December twenty first ninety nine"
or "December twenty first nineteen ninety nine"<context ID = "date_mdy">12/21/1999</context>
will be normalized to "December twenty first nineteen ninety nine" - date_dmy
- This will normalize the date so that the first group of numbers is the day, the second group is the month, and the third group is the year. In the case where the year is a two-digit number, the engine reads it as a two-digit number. If the year is represented as a four-digit number, it is represented as a four-digit year.
For example:
<context ID = "date_dmy">21.12.99</context>
will be normalized to "December twenty first ninety nine"
or "December twenty first nineteen ninety nine"<context ID = "date_ dmy">21-12-1999</context>
will be normalized to "December twenty first nineteen ninety nine" - date_ymd
- This will normalize the date so that the first group of numbers is the year, the second group is the month, and the third group is the day. In the case where the year is a two-digit number, the engine reads it as a two-digit number. If the year is represented as a four-digit number, it is represented as a four-digit year.
For example:
<context ID = "date_ymd">99-12-21</context>
will be normalized to "December twenty first ninety nine"
or "December twenty first nineteen ninety nine"<context ID = "date_ ymd">1999.12.21</context>
will be normalized to "December twenty first nineteen ninety nine" - date_ym
- This will normalize the date so that the first group of numbers is the year, and the second group is the month. In the case where the year is a two-digit number, the engine reads it as a two-digit number. If the year is represented as a four-digit number, it is represented as a four-digit year.
For example:
<context ID = "date_ym">99-12</context>
will be normalized to "December ninety nine"
or "December nineteen ninety nine"
<context ID = "date_ ym">1999.12</context>
will be normalized to "December nineteen ninety nine" - date_my
- This will normalize the date so that the first group of numbers is the month, and the second group is the year. In the case where the year is a two-digit number, the engine reads it as a two-digit number. If the year is represented as a four-digit number, it is represented as a four-digit year.
For example:
<context ID = "date_my">12/99</context>
will be normalized to "December ninety nine"
or "December nineteen ninety nine"<context ID = "date_my">12/1999</context>
will be normalized to "December nineteen ninety nine" - date_dm
- This will normalize the date so that the first group of numbers is the day and the second group is the month.
For example:
<context ID = "date_dm">21.12</context>
will be normalized to "December twenty first" - date_md
- This will normalize the date so that the first group of numbers is the month and the second group is the day.
For example:
<context ID = "date_md">12/21</context>
will be normalized to "December twenty first" - date_year
- This will normalize the date so that the number is read as a year.
For example:
<context ID = "date_year">1999</context>
will be normalized to "nineteen ninety nine"<context ID = "date_year">2001</context>
will be normalized to "Two thousand one"
Time
This context specifies that the number passed to the engine is a time. Times will generally have the format of number [delimiter] number [delimiter] number or number [delimiter] number where the delimiter is ':' or ' ' ' or ' " ' and numbers are typically between 01 and 24 for hours, 01 and 59 for minutes and seconds.
When a zero is present in numbers between 01 and 09, the engine can ignore this, or normalize it as "oh". The engine can place an "and" in the normalized time. The valid string types are:
-
For example:
<context ID = "time">12:30</context>
will be normalized to "twelve thirty"<context ID = "time">01:21</context>
is normalized as "one twenty one"
or "oh one twenty one"<context ID = "time">1'21"</context>
is normalized as "one minute twenty one seconds"
or "one minute and twenty one seconds"
Number
- number_cardinal
- The text is normalized as a number using the regular format of ones, tens, etc. The engine can place "and" in the normalized text.
For example:
<context ID = "number_cardinal">3432</context>
will be normalized to "three thousand four hundred thirty two"<context ID = "number_cardinal">3432</context>
will be normalized to "three thousand four hundred and thirty two" - number_digit
- The text is normalized digit by digit.
For example:
<context ID = "number_digit">3432</context>
will be normalized to "three four three two" - number_fraction
- The text is normalized as a fraction.
For example:
<context ID = "number_fraction">3/15</context>
will be normalized to "three fifteenths" or "three over fifteen" - number_decimal
- The text is normalized as a decimal value.
For example:
<context ID = "number_decimal">423.1243</context>
will be normalized to "four hundred and twenty three point one two four three"
- Phone_Number
- The text is normalized as a phone number. The exact implementation of this is left to the engine developer and may be defined in a future release of SAPI.
- Currency
- The text is normalized as a currency. The exact implementation of this is left to the engine developer and may be defined in a future release of SAPI.
For example:
<context ID = "currency">$34.90</context>
will be normalized to "thirty four dollars and ninety cents"
Web
The text is normalized as a URL. The exact implementation of this is left to the engine developer and may be defined in a future release of SAPI.
- web_url
-
For example:
<context ID = "web_url">www.Microsoft.com</context>
will be normalized to "is normalized to "w w w dot Microsoft dot com"
The text is normalized as e-mail. The exact implementation of this is left to the engine developer and may be defined in a future release of SAPI.
- E-mail_address
- The text is normalized as an e-mail address. The exact implementation of this is left to the engine developer and may be defined in a future release of SAPI.
For example:
<context ID = "E-mail_Address">[email protected]</context>
is normalized to "Someone at Microsoft dot com"
Address
- The text is normalized as an address. The exact implementation of this is left to the engine developer and may be defined in a future release of SAPI.
For example:
<context ID = "address">One Microsoft Way, Redmond, WA, 98052</context>
will be normalized to "One Microsoft Way Redmond Washington nine eight zero five two" - address_postal
- The text is normalized as a postal address. The exact implementation of this is left to the engine developer and may be defined in a future release of SAPI.
For example:
<context ID = "address_postal">A2C 4X5</context>
will be normalized to "A 2 C 4 X 5"