Share via


Time 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 Time rules recognize expressions of time based on a 12-hour clock.

When the user does not specify morning or afternoon, the Time rule returns a value in the Hour element representing the hours from 7 A.M. to 6 P.M. as the assumed value and a value in the AlternateHour hour element representing the hours from 7 P.M. to 6 A.M.

The Time rules recognize expressions such as the following: .

Rules

Time

Time_Hour

Time_HourNum

Time_BeforeAfter

Time_Minute

Time_AmPm

Usage

<ruleref uri="Library.grxml#Time" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Time_Hour" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Time_HourNum" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Time_BeforeAfter" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Time_Minute" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Time_AmPm" type="application/srgs+xml"/>

The grammar can be used as follows (using the Time 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#Time" type="application/srgs+xml"/>
    <tag>$ = $$</tag>
    </rule>
</grammar>

JScript Objects

Rule Name JScript Objects Returned

Time

$Time.Hour
????????$Time.Hour._value: integer [0...23]
????????$Time.Hour._name: string ["Assumed", "Explicit"]
$Time.Minute
????????$Time.Minute: integer [0...59]
$Time.AlternateHour._value: integer [0...23]

Time_Hour

$Time_Hour
????????$Time_Hour.Hour
????????????????$Time_Hour.Hour._value: integer [0...23]
????????????????$Time_Hour.Hour._name: string ["Assumed", "Explicit"]
????????$Time_Hour.AlternateHour._value: integer [0...23] optional

Time_HourNum

$Time_HourNum
????????$Time_HourNum._value: integer [1...12]

Time_BeforeAfter

$Time_BeforeAfter
????????$Time_BeforeAfter._value: integer [-59...59]

Time_Minute

$Time_Minute
????????$Time_Minute._value: integer [1...59]

Time_AmPm

$Time_AmPm
????????$Time_AmPm._value: string ["AM", "PM"]

Examples: Time

Example 1

User says: "Siete treinta de la tarde"

SML returned by the recognition engine.

<SML text="siete treinta de la tarde" utteranceConfidence="1.000" confidence="1.000">

????????<Hour confidence="1.000" name="Explicit">19</Hour>

????????<Minute confidence="1.000">30</Minute>

</SML>

Example 2

User says: "Siete treinta."

SML returned by the recognition engine.

<SML text="siete treinta" utteranceConfidence="1.000" confidence="1.000">

????????<Hour confidence="1.000" name="Assumed">7</Hour>

????????????????<Minute confidence="1.000">30</Minute>

????????????????<AlternateHour confidence="1.000">19</AlternateHour>

</SML>

Examples: Time_BeforeAfter

Example 1

User says: "Un cuarto pasada."

SML returned by the recognition engine.

<SML text="un cuarto pasada" utteranceConfidence="1.000" confidence="1.000">15</SML>

Example 2

User says: "Cuarenta y tres antes."

SML returned by the recognition engine.

<SML text="cuarenta y tres antes" utteranceConfidence="1.000" confidence="1.000">-43</SML>

Examples: Time_AmPm

Example 1

User says: "A.M."

SML returned by the recognition engine.

<SML text="A. M." utteranceConfidence="1.000" confidence="1.000">AM</SML>

Example 2

User says: "De la noche."

SML returned by the recognition engine.

<SML text="de la noche" utteranceConfidence="1.000" confidence="1.000"></SML>

See Also

Concepts

Voice Mode Grammar Library for Spanish (United States)