Share via


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.IsValidDate: string ["true", "false"]
$Date.Month:
????????$Date.Month._value: integer [1...12]
????????$Date.Month._attributes.name: string ["Assumed", "Derived", "Explicit"]
$Date.Day:
????????$Date.Day._value: integer [1...31]
????????$Date.Day._attributes.name: string ["Assumed", "Derived", "Explicit"]
$Date.Year: 
????????$Date.Year._value: integer [1900...2099]
????????$Date.Year._attributes.name: string ["Assumed", "Derived", "Explicit"]
????????$Date.Year._form: string ["ShortForm", "LongForm", "Relative"] Only specified if _name == "Explicit" or "Derived"
$Date.AlternateMonth (Optional):
????????$Date.AlternateMonth._value: integer [1...12]
$Date.AlternateDay (Optional):
????????$Date.AlternateDay._value: integer [1...31]
$Date.AlternateYear (Optional):
????????$Date.AlternateYear._value: integer [1900...2099]

Date_Day

$Date_Day.IsValidDate: string ["true", "false"]
$Date_Day.Month:
????????$Date_Day.Month._value: integer [1...12]
????????$Date_Day.Month._attributes.name: string ["Assumed"]
$Date_Day.Day:
????????$Date_Day.Day._value: integer [1...31]
????????$Date_Day.Day._attributes.name: string ["Explicit"]
$Date_Day.Year: 
????????$Date_Day.Year._value: integer [1900...2099]
????????$Date_Day.Year._attributes.name: string ["Assumed"]
$Date_Day.AlternateMonth:
????????$Date_Day.AlternateMonth._value: integer [1...12]
$Date_Day.AlternateYear:
????????$Date_Day.AlternateYear._value: integer [1900...2099]

Date_Month_Day

$Date_Month_Day.IsValidDate: string ["true", "false"]
$Date_Month_Day.Month:
????????$Date_Month_Day.Month._value: integer [1...12]
????????$Date_Month_Day.Month._attributes.name: string ["Explicit"]
$Date_Month_Day.Day:
????????$Date_Month_Day.Day._value: integer [1...31]
????????$Date_Month_Day.Day._attributes.name: string ["Explicit"]
$Date_Month_Day.Year: 
????????$Date_Month_Day.$Year._value: integer [1900...2099]
????????$Date_Month_Day.$Year._attributes.name: string ["Assumed"]
$Date_Month_Day.AlternateYear:
????????$Date_Month_Day.AlternateYear._value: integer [1900...2099]

Date_Month_Day_Year

$Date_Month_Day_Year.IsValidDate: string ["true", "false"]
$Date_Month_Day_Year.Month:
????????$Date_Month_Day_Year.Month._value: integer [1...12]
????????$Date_Month_Day_Year.Month._attributes.name: string ["Explicit"]
$Date_Month_Day_Year.Day:
????????$Date_Month_Day_Year.Day._value: integer [1...31]
????????$Date_Month_Day_Year.Day._attributes.name: string ["Explicit"]
$Date_Month_Day_Year.Year: 
????????$Date_Month_Day_Year.Year._value: integer [1900...2099]
????????$Date_Month_Day_Year.Year._attributes.name: string ["Assumed"]
????????$Date_Month_Day_Year.Year._form: string ["ShortForm", "LongForm", "Relative"]

Date_Day_Month

$Date_Day_Month.IsValidDate: string ["true", "false"]
$Date_Day_Month.Month:
????????$Date_Day_Month.Month._value: integer [1...12]
????????$Date_Day_Month.Month._attributes.name: string ["Explicit"]
$Date_Day_Month.Day:
????????$Date_Day_Month.Day._value: integer [1...31]
????????$Date_Day_Month.Day._attributes.name: string ["Explicit"]
$Date_Day_Month.Year: 
????????$Date_Day_Month.Year._value: integer [1900...2099]
????????$Date_Day_Month.Year._attributes.name: string ["Assumed"]
$Date_Day_Month.AlternateYear:
????????$Date_Day_Month.AlternateYear._value: integer [1900...2099]

Date_Day_Month_Year

$Date_Day_Month_Year.IsValidDate: string ["true", "false"]
$Date_Day_Month_Year.Month:
????????$Date_Day_Month_Year.Month._value: integer [1...12]
????????$Date_Day_Month_Year.Month._attributes.name: string ["Explicit"]
$Date_Day_Month_Year.Day:
????????$Date_Day_Month_Year.Day._value: integer [1...31]
????????$Date_Day_Month_Year.Day._attributes.name: string ["Explicit"]
$Date_Day_Month_Year.Year: 
????????$Date_Day_Month_Year.Year._value: integer [1900...2099]
????????$Date_Day_Month_Year.Year._attributes.name: string ["Derived", "Explicit"]
????????$Date_Day_Month_Year.Year._form: string ["ShortForm", "LongForm", "Relative"]

Date_MonthNum_DayNum

$Date_MonthNum_DayNum.IsValidDate: string ["true", "false"]
$Date_MonthNum_DayNum.Month:
????????$Date_MonthNum_DayNum.Month._value: integer [1...12]
????????$Date_MonthNum_DayNum.Month._attributes.name: string ["Explicit"]
$Date_MonthNum_DayNum.Day:
????????$Date_MonthNum_DayNum.Day._value: integer [1...31]
????????$Date_MonthNum_DayNum.Day._attributes.name: string ["Explicit"]
$Date_MonthNum_DayNum.Year: 
????????$Date_MonthNum_DayNum.Year._value: integer [1900...2099]
????????$Date_MonthNum_DayNum.Year._attributes.name: string ["Assumed"]
$Date_MonthNum_DayNum.AlternateYear:
????????$Date_MonthNum_DayNum.AlternateYear._value: integer [1900...2099]

Date_MonthNum_DayNum_Year

$Date_MonthNum_DayNum_Year.IsValidDate: string ["true", "false"]
$Date_MonthNum_DayNum_Year.Month:
????????$Date_MonthNum_DayNum_Year.Month._value: integer [1...12]
????????$Date_MonthNum_DayNum_Year.Month._attributes.name: string ["Explicit"]
$Date_MonthNum_DayNum_Year.Day:
????????$Date_MonthNum_DayNum_Year.Day._value: integer [1...31]
????????$Date_MonthNum_DayNum_Year.Day._attributes.name: string ["Explicit"]
$Date_MonthNum_DayNum_Year.Year: 
????????$Date_MonthNum_DayNum_Year.Year._value: integer [1900...2099]
????????$Date_MonthNum_DayNum_Year.Year._attributes.name: string ["Assumed"]

Date_Relative

$Date_Relative.Day.IsValidDate: string ["true", "false"]
$Date_Relative.Month:
$Date_Relative.Month._value: integer [1...12]
$Date_Relative.Month._attributes.name: string ["Assumed", "Derived"]
$Date_Relative.Day:
$Date_Relative.Day._value: integer [1...31]
$Date_Relative.Day._attributes.name: string ["Assumed", "Derived"]
$Date_Relative.Year:
$Date_Relative.Year._value: integer [1900...2099]
$Date_Relative.Year._attributes.name: string ["Derived"]
$Date_Relative.AlternateMonth (Optional):
$Date_Relative.AlternateMonth._value: integer [1...12]
$Date_Relative.AlternateDay (Optional):
$Date_Relative.AlternateDay._value: integer [1...31]
$Date_Relative.AlternateYear (Optional):
$Date_Relative.AlternateYear._value: integer [1900...2099]

Date_MonthNum_Year

$Date_MonthNum_Year.IsValidDate: string ["true", "false"]
$Date_MonthNum_Year.Month:
????????$Date_MonthNum_Year.Month._value: integer [1...12]
????????$Date_MonthNum_Year.Month._attributes.name: string ["Explicit"]
$Date_MonthNum_Year.Year: 
????????$Date_MonthNum_Year.Year._value: integer [1900...2099]
????????$Date_MonthNum_Year.Year._attributes.name: string ["Derived", "Explicit"]
????????$Date_MonthNum_Year.Year._form: string ["ShortForm", "LongForm", "Relative"]

Date_Month_Year

$Date_Month_Year.IsValidDate: string ["true", "false"]
$Date_Month_Year.Month:
????????$Date_Month_Year.Month._value: integer [1...12]
????????$Date_Month_Year.Month._attributes.name: string ["Explicit"]
$Date_Month_Year.Year: 
????????$Date_Month_Year.Year._value: integer [1900...2099]
????????$Date_Month_Year.Year._attributes.name: string ["Derived", "Explicit"]
????????$Date_Month_Year.Year._form: string ["ShortForm", "LongForm", "Relative"]

Date_Weekday

$Date_Weekday._value : integer [1...7] Sunday=1, Monday=2, ..., Saturday=7

Date_Month29

$Date_Month29._value: integer [2]

Date_Month30

$Date_Month30._value: integer [4,6,9,11]

Date_Month31

$Date_Month31._value: integer [1,3,5,7,8,10,12]

Date_MonthNum29

$Date_MonthNum29._value: integer [2]

Date_MonthNum30

$Date_MonthNum30._value: integer [4,6,9,11]

Date_MonthNum31

$Date_MonthNum31._value: integer [1,3,5,7,8,10,12]

Date_DayNum29

$Date_DayNum29._value: integer [1...29]

Date_DayNum30

$Date_DayNum30._value: integer [1...30]

Date_DayNum31

$Date_DayNum31._value: integer [1...31]

Date_Year

$Date_Year._value: integer [1900...2099]
$Date_Year._attributes.name: string ["Derived", "Explicit"]
$Date_Year._form: string ["Long Form", "Short Form", "Relative"]
Bb801313.note(en-us,office.12).gifNote:
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>

See Also

Concepts

Voice Mode Grammar Library for Spanish (United States)