Freigeben über


TimeBlock Rule for Spanish (United States)

  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="es-US" 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 el desayuno y el almuerzo.

SML returned by the recognition engine:

<SML confidence="1.000" text="entre el desayuno y el almuerzo" utteranceConfidence="1.000">
   <StartTime confidence="1.000" text="el desayuno">
      <ApproximatedTime confidence="1.000" text="el desayuno">EarlyMorning</ApproximatedTime>
   </StartTime>
   <EndTime confidence="1.000" text="almuerzo">
      <ApproximatedTime confidence="1.000" text="almuerzo">Noon</ApproximatedTime>
   </EndTime>
</SML>

Example 2

User says: empezar desde las dos y media hasta las cinco y media.

SML returned by the recognition engine:

<SML confidence="1.000" text="empezar desde las dos y media hasta las cinco y media" utteranceConfidence="1.000">
   <StartTime confidence="1.000" text="las dos y media">
      <Hour confidence="1.000" text="las dos">14</Hour>
      <Minute confidence="1.000" text="y media">30</Minute>
      <AlternativeHour confidence="1.000">2</AlternativeHour>
   </StartTime>
   <EndTime confidence="1.000" text="las cinco y media">
      <Hour confidence="1.000" text="las cinco">17</Hour>
      <Minute confidence="1.000" text="y media">30</Minute>
      <AlternativeHour confidence="1.000">5</AlternativeHour>
   </EndTime>
</SML>

Example 3

User says: de ocho a cinco. 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 ocho a cinco" utteranceConfidence="1.000">
   <StartTime confidence="1.000" text="ocho">
      <Hour confidence="1.000" text="ocho">8</Hour>
      <Minute>0</Minute>
   </StartTime>
   <EndTime confidence="1.000" text="cinco">
      <Hour type="Hour" name="CommonTime">5</Hour> 
      <Minute>0</Minute> 
   </EndTime>
</SML>

Example 4

User says: de una a nueve. 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 una a nueve" utteranceConfidence="1.000">
   <StartTime confidence="1.000" text="una">
      <Hour confidence="1.000" text="una">1</Hour>
      <Minute>0</Minute>
   </StartTime>
   <EndTime confidence="1.000" text="nueve">
      <Hour confidence="1.000" text="nueve">9</Hour> 
      <Minute>0</Minute>
   </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="es-US" 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: antes de las dos y media p. m.

SML returned by the recognition engine:

<SML confidence="1.000" text="antes de las dos y media p. m." utteranceConfidence="1.000">
   <TimePrep confidence="1.000">Before</TimePrep> 
   <ReferenceTime confidence="1.000" text="las dos y media p. m.">
      <Hour confidence="1.000" text="las dos p. m.">14</Hour>
      <Minute confidence="1.000" text="y media">30</Minute>
   </ReferenceTime>
</SML>

Example 2

User says: hasta las seis p. m.

SML returned by the recognition engine:

<SML confidence="1.000" text="hasta las seis p. m." utteranceConfidence="1.000">
  <TimePrep>Before</TimePrep> 
  <ReferenceTime confidence="1.000" text="seis p. m.">
    <Hour confidence="1.000" text="seis p. m.">18</Hour> 
    <Minute confidence="1.000">0</Minute> 
  </ReferenceTime>
</SML>

Example 3

User says: inmediatamente después de las cuatro y media. 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="inmediatamente después de las cuatro y media" utteranceConfidence="1.000">
   <TimePrep>RightAfter</TimePrep> 
   <ReferenceTime confidence="1.000" text="las cuatro y media">
      <Hour confidence="1.000" text="la cuatro">16</Hour> 
      <Minute confidence="1.000" text="y media">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="es-US" 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: al mediodía.

SML returned by the recognition engine:

<SML confidence="1.000" text="al mediodía" utteranceConfidence="1.000">
   <ApproximatedTimeBlock confidence="1.000" text="al mediodía">Noon</ApproximatedTimeBlock> 
</SML>

Example 2

User says: no importa cuando.

SML returned by the recognition engine:

<SML confidence="1.000" text="no importa cuando" utteranceConfidence="1.000">
   <ApproximatedTimeBlock confidence="1.000" text="no importa cuando">WholeDay</ApproximatedTimeBlock> 
</SML>

See Also

Voice Mode Grammar Library | DTMF Mode Grammar Library