Partager via


Time Rules for French (Canada)

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.

Time rules recognize expressions of time based on both a 12-hour and 24-hour clock.

When the user says a number between 1 and 12 and 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. For example, if the user says "une heure," the assumed value is 1 P.M. and the alternate value is 1 A.M.

The Time rules recognize expressions such as the following: "dix heures du matin, midi et demie, sept heures, six heures moins cinq, dix heures et deux minutes, dix heures moins quart, quinze heures et quart, sept heures vingt-cinq du matin, dix-huit heures vingt."

Rules

Time

Time_Hour

Time_HourNum_2_to_11

Time_HourNum_13_to_23

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_2_to_11" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Time_HourNum_13_to_23" 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="fr-CA" 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] 

Time_HourNum_2_to_11

$Time_HourNum_2_to_11
????????$Time_HourNum_2_to_11._value: integer [2...11]

Time_HourNum_13_to_23

$Time_HourNum_13_to_23
????????$Time_HourNum_13_to_23._value: integer [13...23]

Time_BeforeAfter

$Time_BeforeAfter
????????$Time_BeforeAfter._hour: integer [0, -1]
????????$Time_BeforeAfter._minute: integer [0...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: "une heure de l???apr??s-midi"

SML returned by the recognition engine.

<SML text="une heure de l???apr??s-midi" utteranceConfidence="1.000" confidence="1.000">

????????<Hour confidence="1.000">

????????????????13

????????????????<_name confidence="1.000">explicit</_name>

????????</Hour>

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

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

</SML>

Example 2

User says: "neuf heures du matin."

SML returned by the recognition engine.

<SML text="neuf heures du matin" utteranceConfidence="1.000" confidence="1.000">

????????<Hour confidence="1.000">

????????????????9

????????????????<_name confidence="1.000">explicit<_name>

????????</Hour>

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

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

</SML>

Examples: Time_BeforeAfter

Example 1

User says: "et quart."

SML returned by the recognition engine.

<SML text="et quart" utteranceConfidence="1.000" confidence="1.000">

????????<_minute confidence="1.000">15</_minute>

????????<_hour confidence="1.000">0</_hour>

</SML>

Example 2

User says: "moins quart."

SML returned by the recognition engine.

<SML text="moins quart" utteranceConfidence="1.000" confidence="1.000">

????????<_minute confidence="1.000">45</_minute>

????????<_hour confidence="1.000">-1</_hour>

</SML>

Examples: Time_AmPm

Example 1

User says: "du matin."

SML returned by the recognition engine.

<SML text="du matin" utteranceConfidence="1.000" confidence="1.000">AM</SML>

Example 2

User says: "du soir."

SML returned by the recognition engine.

<SML text="du soir" utteranceConfidence="1.000" confidence="1.000">PM</SML>