Date Rules for Spanish (United States)
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.
The 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 "Marzo veintidos dos mil siete."
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, 2007, and the user says "Mayo veinticuatro," the Date_Month_Day rule returns the following values:
- Day = 24
- Month = 5
- Year = 2008
- AlternateYear = 2007
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 one-digit or two-digit cardinal month number. For example, "Enero, cero uno, uno."
- A cardinal month number followed by a cardinal day number. For example, "dos veintidos, siete treinta y uno."
- A cardinal month number followed by the modifier "de" followed by a month name. The expression can optionally be preceded by an article. For example, "veinte de Febrero, el treinta de Junio."
- A month name followed by a cardinal day number. The expression can optionally be preceded by a day name. For example, "Mayo treinta y uno, Lunes Marzo dos."
- All of the previously noted expressions followed by a cardinal year number in two-digit or four-digit form. For example, "diez de Junio mil novecientos ochenta y dos, siete treinta cero cinco, Abril mil novecientos."
- A cardinal year number in two-digit or four-digit form or a relative year expression. For example, "cero siete, dos mil siete, este a??o, pr??ximo a??o, el a??o pasado."
- A cardinal day number. For example, "once, veintiocho, treinta y uno."
- Common relative day expressions. For example, "hoy, ma??ana, ayer."
- Weekday names. For example, "Jueves, Viernes."
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_Month31
Date_Month30
Date_Month29
Date_MonthNum31
Date_MonthNum30
Date_MonthNum29
Date_DayNum31
Date_DayNum30
Date_DayNum29
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_Month29" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_Month30" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_Month31" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_MonthNum29" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_MonthNum30" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_MonthNum31" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_DayNum29" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_DayNum30" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Date_DayNum31" 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="es-US" 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 | JScript Objects Returned |
---|---|
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_Month29 |
|
Date_Month30 |
|
Date_Month31 |
|
Date_MonthNum29 |
|
Date_MonthNum30 |
|
Date_MonthNum31 |
|
Date_DayNum29 |
|
Date_DayNum30 |
|
Date_DayNum31 |
|
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, January 15, 2007.
User says: "Uno tres."
SML returned by the recognition engine.
<SML text="uno tres" utteranceConfidence="1.000" confidence="1.000">
????????<Day confidence="1.000" name="Explicit">3</Day>
????????<Month confidence="1.000" name="Explicit">1</Month>
????????<Year confidence="1.000" name="Assumed">2008</Year>
????????<AlternateYear confidence="1.000">2007</AlternateYear>
????????<IsValidDate confidence="1.000">true</IsValidDate>
</SML>
Example 2
Assume that the current date is Monday, January 15, 2007.
User says: "Cinco tres."
SML returned by the recognition engine.
<SML text="Cinco tres" utteranceConfidence="1.000" confidence="1.000">
????????<Day confidence="1.000" name="Explicit">3</Day>
????????<Month confidence="1.000" name="Explicit">5</Month>
????????<Year confidence="1.000" name="Assumed">2007</Year>
????????<AlternateYear confidence="1.000">2006</AlternateYear>
????????<IsValidDate confidence="1.000">true</IsValidDate>
</SML>
Example: Date_Month_Day
Example 1
Assume that the current date is Monday, January 15, 2007.
User says: "Lunes Enero dos."
SML returned by the recognition engine.
<SML text="Lunes Enero dos" utteranceConfidence="1.000" confidence="1.000">
????????<Day confidence="1.000" name="Explicit">2</Day>
????????<Month confidence="1.000" name="Explicit">1</Month>
????????<Year confidence="1.000" name="Assumed">2008</Year>
????????<AlternateYear confidence="1.000">2007</AlternateYear>
????????<IsValidDate confidence="1.000">true</IsValidDate>
</SML>
Example: Date_Day_Month
Example 1
Assume that the current date is Monday, January 15, 2007.
User says: "Lunes dos de Enero."
SML returned by the recognition engine.
<SML text="Lunes dos de Enero" utteranceConfidence="1.000" confidence="1.000">
????????<Day confidence="1.000" name="Explicit">1</Day>
????????<Month confidence="1.000" name="Explicit">2</Month>
????????<Year confidence="1.000" name="Assumed">2007</Year>
????????<AlternateYear confidence="1.000">2006</AlternateYear>
????????<IsValidDate confidence="1.000">true</IsValidDate>
</SML>
Examples: Date_Month_Day_Year
Example 1
Assume that the current date is Monday, January 15, 2007.
User says: "Martes Marzo dos dos mil siete."
SML returned by the recognition engine.
<SML text="Martes Marzo dos dos mil siete" 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 confidence="1.000">Long Form</_form>
????????????????2007
????????</Year>
</SML>
Example 2
Assume that the current date is Monday, January 15, 2007.
User says: "Martes Marzo dos cero siete."
SML returned by the recognition engine.
<SML text="Martes Marzo dos cero siete" 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 confidence="1.000">Short Form</_form>
????????????????2007
????????????????</Year>
</SML>
Examples: Date_Year
Example 1
User says: "Mil novecientos noventa y siete."
SML returned by the recognition engine.
<SML text="mil novecientos noventa y siete" utteranceConfidence="1.000" confidence="1.000" name="Explicit">
????????<_form confidence="1.000">Long Form</_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 confidence="1.000">Short Form</_form>
????????1997
</SML>
Examples: Date_Relative
Example 1
Assume that the current date is Monday, January 15, 2007.
User says: "Domingo."
SML returned by the recognition engine.
<SML text="Domingo" utteranceConfidence="1.000" confidence="1.000">
????????<Day confidence="1.000" name="Derived">21</Day>
????????<Month confidence="1.000" name="Derived">1</Month>
????????<Year confidence="1.000" name="Derived">2007</Year>
????????<AlternateMonth confidence="1.000">1</AlternateMonth>
????????<AlternateYear confidence="1.000">2007</AlternateYear>
????????<AlternateDay confidence="1.000">14</AlternateDay>
????????<IsValidDate confidence="1.000">true</IsValidDate>
</SML>
Example 2
Assume that the current date is Monday, January 15, 2007.
User says: "Pr??ximo Domingo."
SML returned by the recognition engine.
<SML text="pr??ximo Domingo" utteranceConfidence="1.000" confidence="1.000">
????????<Day confidence="1.000" name="Derived">21</Day>
????????<Month confidence="1.000" name="Derived">1</Month>
????????<Year confidence="1.000" name="Derived">2007</Year>
????????<AlternateMonth confidence="1.000">1</AlternateMonth>
????????<AlternateYear confidence="1.000">2007</AlternateYear>
????????<AlternateDay confidence="1.000">28</AlternateDay>
????????<IsValidDate confidence="1.000">true</IsValidDate>
</SML>
Example 3
Assume that the current date is Monday, January 15, 2007.
User says: "Domingo pasado."
SML returned by the recognition engine.
<SML text="Domingo pasado" utteranceConfidence="1.000" confidence="1.000">
????????<Day confidence="1.000" name="Derived">14</Day>
????????<Month confidence="1.000" name="Derived">1</Month>
????????<Year confidence="1.000" name="Derived">2007</Year>
????????<AlternateMonth confidence="1.000">1</AlternateMonth>
????????<AlternateYear confidence="1.000">2007</AlternateYear>
????????<AlternateDay confidence="1.000">7</AlternateDay>
????????<IsValidDate confidence="1.000">true</IsValidDate>
</SML>