example Element

Specifies sample phrases that a user can say to match the containing rule. This element is illustrative and for the benefit of a developer reading the grammar; the speech recognition engine ignores it.

Syntax

<example>...</example>

Attributes

None.

Example

<?xml version="1.0" encoding="utf-8"?>
<grammar xml:lang="en-US" root="BlueGreen" tag-format="semantics/1.0" version="1.0" 
xmlns="http://www.w3.org/2001/06/grammar">

  <rule id="BlueGreen" scope="public">

    <example> blue </example>
    <example> indigo </example>
    <example> green </example>
    <example> emerald </example>

    <item>  
      <one-of>
        <item> <ruleref uri="#Blue"/> <tag> out.color=rules.Blue; </tag> </item>
        <item> <ruleref uri="#Green"/> <tag> out.color=rules.Green; </tag> </item>
      </one-of>
    </item>
  </rule>

  <rule id="Blue" scope="public">
    <tag> out="blue"; </tag>
    <one-of>
      <item> blue </item>
      <item> indigo </item>
      <item> azure </item>
    </one-of> 
  </rule>   

  <rule id="Green" scope="public">
    <tag> out="green"; </tag>
    <one-of>
      <item> green </item>
      <item> teal </item>
      <item> emerald </item>
    </one-of> 
  </rule>

</grammar>

Show: