Date Rules for English (United Kingdom)
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Date rules recognize dates expressed in a number of forms. The particular form that is recognized by a rule is encoded in the name of the rule. For example, the Date_Month_Day_Year rule recognizes date expressions such as "March twenty second two thousand and five."
When the year, month, or day in a date expression is ambiguous, the rules return an alternate semantic value. The default semantic value assumes a future date. Alternate semantic values presume a past date. For example, if today is June 1, 2005, and the user says "May twenty fourth," the Date_Month_Day rule returns the following values:
- Day = 24
- Month = 5
- Year = 2006
- AlternateYear = 2005
Default date semantic item values are error checked for consistency (for example, that February 29th only falls on leap years). Alternate date semantic item values are not checked for consistency. The IsValidDate semantic item value is set to false if the default semantic date is not valid.
What the Date Rules Recognize
The Date rules recognize dates expressed as the following:
- A month name or a cardinal month number. For example, "February; April; December; oh four; six."
- A cardinal month number followed by a cardinal day number. For example, "five twenty one; three two; six nine."
- A month name followed by an ordinal day number or an ordinal day number followed by a month name. For example, "May the twenty first; Tuesday March second; June ninth; the twenty first of May; Tuesday the second of March; the ninth of June."
- All of the previously noted expressions followed by a cardinal year number in two-digit or four-digit form. For example, "May the twenty first two thousand and five; Tuesday March second ninety seven; June ninth nineteen sixty five; the twenty first of May two thousand and five; Tuesday the second of March ninety seven; the ninth of June nineteen sixty two; five twenty one two thousand six; three two nineteen ninety seven; six nine two thousand five; five twenty one; three two thousand and five; six nineteen ninety seven; May twenty one; March two thousand and five; June nineteen ninety seven."
- A cardinal year number in two-digit or four-digit form or a relative year expression. For example, "nineteen hundred and five; ninety nine; oh one; two thousand and five; two thousand and eleven; next year."
- An ordinal or a cardinal day number. For example, "on the first; the twenty second; one; eleven; twenty nine."
- Common relative day expressions. For example, "yesterday; today; tomorrow; next Tuesday; Tuesday; last Tuesday."
- Weekday names. For example, "Sunday; Friday."
Rules
Date
Date_Day
Date_Month_Day
Date_Month_Day_Year
Date_Day_Month
Date_Day_Month_Year
Date_MonthNum_DayNum
Date_MonthNum_DayNum_Year
Date_Relative
Date_MonthNum_Year
Date_Month_Year
Date_Weekday
Date_Month
Date_MonthNum
Date_DayNum
Date_Year
Usage
<ruleref uri="Library.grxml#Date" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_Day" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_Month_Day" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_Month_Day_Year" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_Day_Month" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_Day_Month_Year" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_MonthNum_DayNum" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_MonthNum_DayNum_Year" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_Relative" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_MonthNum_Year" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_Month_Year" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_Weekday" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_Month" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_MonthNum" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_DayNum" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_Year" type="application/srgs+xml"/>
The grammar can be used as follows (using the Date rule as an example).
<grammar xmlns:sapi="http://schemas.microsoft.com/Speech/2002/06/SRGSExtensions"
xml:lang="en-GB" tag-format="semantics-ms/1.0" version="1.0" mode="voice"
root="Rule1" xmlns="http://www.w3.org/2001/06/grammar">
<rule id="Rule1" scope="public">
<ruleref uri="Library.grxml#Date" type="application/srgs+xml"/>
<tag>$ = $$</tag>
</rule>
</grammar>
JScript Objects
Rule Name | Returned JScript objects |
---|---|
Date |
|
Date_Day |
|
Date_Month_Day |
|
Date_Month_Day_Year |
|
Date_Day_Month |
|
Date_Day_Month_Year |
|
Date_MonthNum_DayNum |
|
Date_MonthNum_DayNum_Year |
|
Date_Relative |
|
Date_MonthNum_Year |
|
Date_Month_Year |
|
Date_Weekday |
|
Date_Month |
|
Date_MonthNum |
|
Date_DayNum |
|
Date_Year |
Note:
The Date_Year rule supports years between 1900 and 2099. If the caller specifies only the last two digits (DD) of a year, the behavior is as follows: If DD > 30 returns 20DD; else if DD ??? 30 returns 19DD.
|
Examples: Date_MonthNum_DayNum
Example 1
Assume that the current date is Monday, April 4, 2005.
User says "Three three."
SML returned by the recognition engine.
<SML text="three three" utteranceConfidence="1.000" confidence="1.000">
????????<Day confidence="1.000" name="Explicit">3</Day>
????????<Month confidence="1.000" name="Explicit">3</Month>
????????<Year confidence="1.000" name="Assumed">2006</Year>
????????<AlternateYear confidence="1.000">2005</AlternateYear>
????????<IsValidDate confidence="1.000">true</IsValidDate>
</SML>
Example 2
Assume that the current date is Monday, April 4, 2005.
User says "Five three."
SML returned by the recognition engine.
<SML text="five three" utteranceConfidence="1.000" confidence="1.000">
????????<Day confidence="1.000" name="Explicit">5</Day>
????????<Month confidence="1.000" name="Explicit">3</Month>
????????<Year confidence="1.000" name="Assumed">2006</Year>
????????<AlternateYear confidence="1.000">2005</AlternateYear>
????????<IsValidDate confidence="1.000">true</IsValidDate>
</SML>
Example: Date_Month_Day
Example 1
Assume that the current date is Monday, April 4, 2005.
User says "Tuesday March second."
SML returned by the recognition engine.
<SML text="Tuesday March second" utteranceConfidence="1.000" confidence="1.000">
????????<Day confidence="1.000" name="Explicit">2</Day>
????????<Month confidence="1.000" name="Explicit">3</Month>
????????<Year confidence="1.000" name="Assumed">2006</Year>
????????<AlternateYear confidence="1.000">2005</AlternateYear>
????????<IsValidDate confidence="1.000">true</IsValidDate>
</SML>
Example: Date_Day_Month
Example 1
Assume that the current date is Monday, April 4, 2005.
User says "Tuesday the second of March."
SML returned by the recognition engine.
<SML text="Tuesday the second of March" utteranceConfidence="1.000" confidence="1.000">
????????<Day confidence="1.000" name="Explicit">2</Day>
????????<Month confidence="1.000" name="Explicit">3</Month>
????????<Year confidence="1.000" name="Assumed">2006</Year>
????????<AlternateYear confidence="1.000">2005</AlternateYear>
????????<IsValidDate confidence="1.000">true</IsValidDate>
</SML>
Examples: Date_Month_Day_Year
Example 1
Assume that the current date is Monday, April 4, 2005.
User says "Tuesday March second two thousand five."
SML returned by the recognition engine.
<SML text="Tuesday March second two thousand five" utteranceConfidence="1.000" confidence="1.000">
????????<Day confidence="1.000" name="Explicit">2</Day>
????????<Month confidence="1.000" name="Explicit">3</Month>
????????<IsValidDate confidence="1.000">true</IsValidDate>
????????<Year confidence="1.000" name="Explicit" form="Long Form">2005</Year>
</SML>
Example 2
Assume that the current date is Monday, April 4, 2005.
User says "Tuesday March second oh five."
SML returned by the recognition engine.
<SML text="Tuesday March second oh five" utteranceConfidence="1.000" confidence="1.000">
????????<Day confidence="1.000" name="Explicit">2</Day>
????????<Month confidence="1.000" name="Explicit">3</Month>
????????<IsValidDate confidence="1.000">true</IsValidDate>
????????<Year confidence="1.000" name="Explicit" form="Short Form">2005</Year>
</SML>
Examples: Date_Year
Example 1
User says "Nineteen ninety seven."
SML returned by the recognition engine.
<SML text="nineteen ninety seven" utteranceConfidence="1.000" confidence="1.000" name="Explicit" form="Long Form ">1997</SML>
Example 2
User says "ninety seven."
SML returned by the recognition engine.
<SML text="ninety seven" utteranceConfidence="1.000" confidence="1.000" name="Derived" form="Short Form">1997</SML>
Examples: Date_Relative
Example 1
Assume that the current date is Monday, April 4, 2005.
User says "Sunday."
SML returned by the recognition engine.
<SML text="Sunday" utteranceConfidence="1.000" confidence="1.000">
????????<Day confidence="1.000" name="Derived">10</Day>
????????<Month confidence="1.000" name="Derived">4</Month>
????????<Year confidence="1.000" name="Derived">2005</Year>
????????<AlternateMonth confidence="1.000">4</AlternateMonth>
????????<AlternateYear confidence="1.000">2005</AlternateYear>
????????<AlternateDay confidence="1.000">3</AlternateDay>
????????<IsValidDate confidence="1.000">true</IsValidDate>
</SML>
Example 2
Assume that the current date is Monday, April 4, 2005.
User says "Next Sunday."
SML returned by the recognition engine.
<SML text="next Sunday" utteranceConfidence="1.000" confidence="1.000">
????????<Day confidence="1.000" name="Derived">10</Day>
????????<Month confidence="1.000" name="Derived">4</Month>
????????<Year confidence="1.000" name="Derived">2005</Year>
????????<AlternateMonth confidence="1.000">4</AlternateMonth>
????????<AlternateYear confidence="1.000">2005</AlternateYear>
????????<AlternateDay confidence="1.000">17</AlternateDay>
????????<IsValidDate confidence="1.000">true</IsValidDate>
</SML>
Example 3
Assume that the current date is Monday, April 4, 2005.
User says "Last Sunday."
SML returned by the recognition engine.
<SML text="last Sunday" utteranceConfidence="1.000" confidence="1.000">
????????<Day confidence="1.000" name="Derived">10</Day>
????????<Month confidence="1.000" name="Derived">4</Month>
????????<Year confidence="1.000" name="Derived">2005</Year>
????????<AlternateMonth confidence="1.000">3</AlternateMonth>
????????<AlternateYear confidence="1.000">2005</AlternateYear>
????????<AlternateDay confidence="1.000">27</AlternateDay>
????????<IsValidDate confidence="1.000">true</IsValidDate>
</SML>