Compartilhar via


TimeBlock Rule for French (Canada)

  Microsoft Speech Technologies Homepage

Retrieves blocks of time. The following time blocks are retrieved.

  • Closed Time Block
  • Open Time Block
  • Approximated Time Block

The TimeBlock rule is used to trigger these blocks of time. This rule does not support evaluated relative time. For example, "in one hour" is not recognized.

Closed Time Block

A closed time block is a period of time that is bounded by a start and an end time. The TimeBlock rule returns both the start and end time when an utterance is evaluated as a closed time block. The start time is enclosed in a StartTime tag containing time elements, for example, approximated time or hour and minute elements. The end time is enclosed in an EndTime tag containing the same elements.

Rule

TimeBlock

Usage

<ruleref uri="cmnrules.cfg#TimeBlock"/>

The grammar can be used as follows:

<grammar version="1.0" mode="voice" root="Rule1" tag-format="semantics-ms/1.0" 
  xml:lang="fr-CA" xmlns="http://www.w3.org/2001/06/grammar" 
  xmlns:sapi="https://schemas.microsoft.com/Speech/2002/06/SRGSExtensions">
    <rule id="Rule1">
      <ruleref uri="cmnrules.cfg#TimeBlock"/>
    <tag>$ = $$</tag>
    </rule>
</grammar>

JScript Objects

$TimeBlock.StartTime : Time
$TimeBlock.EndTime : Time

Examples: Closed Time Block

Example 1

User says: entre déjeuner et le dîner.

SML returned by the recognition engine:

<SML confidence="1.000" text="entre déjeuner et le dîner" utteranceConfidence="1.000">
  <StartTime confidence="1.000" text="déjeuner">
      <ApproximatedTime confidence="1.000" text="déjeuner">EarlyMorning</ApproximatedTime>
  </StartTime>
  <EndTime confidence="1.000" text="le dîner">
      <ApproximatedTime confidence="1.000" text="le dîner">Noon</ApproximatedTime>
  </EndTime>
</SML>

Example 2

User says: de deux heures et demi à cinq heures et demi.

SML returned by the recognition engine:

<SML confidence="1.000" text="de deux heures et demi à cinq heures et demi" utteranceConfidence="1.000">
  <StartTime confidence="1.000" text="deux heures et demi">
      <Hour confidence="1.000" text="deux heures">14</Hour>
      <Minute confidence="1.000">30</Minute>
      <AlternativeHour confidence="1.000">2</AlternativeHour>
  </StartTime>
  <EndTime confidence="1.000" text="cinq heures et demi">
      <Hour confidence="1.000" text="cinq heures">17</Hour>
      <Minute confidence="1.000">30</Minute>
      <AlternativeHour confidence="1.000">5</AlternativeHour>
  </EndTime>
</SML>

Example 3

User says: de huit heures à cinq heures. Because the user specified neither morning nor afternoon, the TimeBlock module uses the 7 A.M. to 7 P.M. preference rule and provides an alternative hour.

SML returned by the recognition engine:

<SML confidence="1.000" text="de huit heures à cinq heures" utteranceConfidence="1.000">
  <StartTime confidence="1.000" text="huit heures">
      <Hour confidence="1.000" text="huit heures">8</Hour>
      <Minute confidence="1.000">0</Minute>
      <AlternativeHour confidence="1.000">20</AlternativeHour>
  </StartTime>
  <EndTime confidence="1.000" text="cinq heures">
      <Hour confidence="1.000" text="cinq heures">17</Hour>
      <Minute confidence="1.000">0</Minute>
      <AlternativeHour confidence="1.000">5</AlternativeHour>
  </EndTime>
</SML>

Example 4

User says: de une heure à neuf heures. Because the user specified neither morning nor afternoon, the TimeBlock module uses the 7 A.M. to 7 P.M. preference rule and provides an alternative hour. Also, there is no check to guarantee that the end time is later than the start time.

SML returned by the recognition engine:

<SML confidence="1.000" text="de une heure à neuf heures" utteranceConfidence="1.000">
  <StartTime confidence="1.000" text="une heure ">
      <Hour confidence="1.000" text="une heure">13</Hour>
      <Minute confidence="1.000">0</Minute>
      <AlternativeHour confidence="1.000">1</AlternativeHour>
  </StartTime>
  <EndTime confidence="1.000" text="neuf heures">
      <Hour confidence="1.000" text="neuf heures">9</Hour>
      <Minute confidence="1.000">0</Minute>
      <AlternativeHour confidence="1.000">21</AlternativeHour>
  </EndTime>
</SML>

Open Time Block

An open time block contains one end point and a reference preposition. The end point may be specified by either a time reference (containing Hour and Minute elements) or an approximated time. The reference preposition is either Before or After.

Rule

TimeBlock

Usage

<ruleref uri="cmnrules.cfg#TimeBlock"/>

The grammar can be used as follows:

<grammar version="1.0" mode="voice" root="Rule1" tag-format="semantics-ms/1.0" 
  xml:lang="fr-CA" xmlns="http://www.w3.org/2001/06/grammar" 
  xmlns:sapi="https://schemas.microsoft.com/Speech/2002/06/SRGSExtensions">
    <rule id="Rule1">
      <ruleref uri="cmnrules.cfg#TimeBlock"/>
    <tag>$ = $$</tag>
    </rule>
</grammar>

JScript Objects

$TimeBlock.ReferenceTime : Time
$TimeBlock.TimePrep : string

Examples: Open Time Block

Example 1

User says: avant midi.

SML returned by the recognition engine:

<SML confidence="1.000" text="avant midi" utteranceConfidence="1.000">
  <TimePrep>Before</TimePrep>
  <ReferenceTime confidence="1.000" text="midi">
      <Hour confidence="1.000" text="midi">12</Hour>
      <Minute confidence="1.000">0</Minute>
      <AlternativeHour confidence="1.000">0</AlternativeHour>
  </ReferenceTime>
</SML>

Example 2

User says: avant deux heures trente de l'après-midi

SML returned by the recognition engine:

<SML confidence="1.000" text="avant deux heures trente de l'après-midi" utteranceConfidence="1.000">
  <TimePrep>Before</TimePrep>
  <ReferenceTime confidence="1.000" text="deux heures trente de l'après-midi">
      <Hour confidence="1.000" text="deux heures de l'après-midi">14</Hour>
      <Minute confidence="1.000" text="trente">30</Minute>
  </ReferenceTime>
</SML>

Example 3

User says: jusqu'à six heures p. m.

SML returned by the recognition engine:

<SML confidence="1.000" text="jusqu'à six heures p. m." utteranceConfidence="1.000">
  <TimePrep>Before</TimePrep> 
  <ReferenceTime confidence="1.000" text="six heures p. m.">
    <Hour confidence="1.000" text="six heures p. m.">18</Hour> 
    <Minute confidence="1.000">0</Minute> 
  </ReferenceTime>
</SML>

Example 4

User says: immédiatement après quatre heures trente. Neither morning nor afternoon is specified. The TimeBlock module assumes A.M. and also returns an alternative hour.

SML returned by the recognition engine:

<SML confidence="1.000" text="immédiatement après quatre heures trente" utteranceConfidence="1.000">
  <TimePrep>RightAfter</TimePrep>
  <ReferenceTime confidence="1.000" text="quatre heures trente">
      <Hour confidence="1.000" text="quatre heures">16</Hour>
      <Minute confidence="1.000" text="trente">30</Minute>
      <AlternativeHour confidence="1.000">4</AlternativeHour>
  </ReferenceTime>
</SML>

Approximated Time Block

Approximated time blocks do not contain boundary time. The TimeBlock rule returns an enumeration value to the application. The following table specifies the set of defined enumeration values.

Morning Noon
Midday Afternoon
Evening RestOfTheDay
WholeDay  

Rule

TimeBlock

Usage

<ruleref uri="cmnrules.cfg#TimeBlock"/>

The grammar can be used as follows:

<grammar version="1.0" mode="voice" root="Rule1" tag-format="semantics-ms/1.0" 
  xml:lang="fr-CA" xmlns="http://www.w3.org/2001/06/grammar" 
  xmlns:sapi="https://schemas.microsoft.com/Speech/2002/06/SRGSExtensions">
    <rule id="Rule1">
      <ruleref uri="cmnrules.cfg#TimeBlock"/>
    <tag>$ = $$</tag>
    </rule>
</grammar>

JScript Object

$TimeBlock.ApproximatedTimeBlock._value : string

Examples: Approximated Time Block

Example 1

User says: au matin.

SML returned by the recognition engine:

<SML confidence="1.000" text="au matin" utteranceConfidence="1.000">
   <ApproximatedTimeBlock confidence="1.000" text="au matin">Morning</ApproximatedTimeBlock> 
</SML>

Example 2

User says: midi.

SML returned by the recognition engine:

<SML confidence="1.000" text="midi" utteranceConfidence="1.000">
   <ApproximatedTimeBlock confidence="1.000" text="midi">Noon</ApproximatedTimeBlock> 
</SML>

Example 3

User says: n'importe quand.

SML returned by the recognition engine:

<SML confidence="1.000" text="n'importe quand" utteranceConfidence="1.000">
   <ApproximatedTimeBlock confidence="1.000" text="n'importe quand">WholeDay</ApproximatedTimeBlock> 
</SML>

See Also

Voice Mode Grammar Library | DTMF Mode Grammar Library