New in VoiceXML 2.0. XML grammar element that defines a grammar rule.
<rule
id="string"
scope="private"|"public"
>
Other Content
</rule>
This tag is used to define grammars in the XML form of the W3C Speech Recognition Grammar Format.
A <rule> element can contain any number of input elements, examples, and <tag> elements. The input elements indicate a sequence that must be matched in order.
Any contained <tag> elements apply to the entire sequence. If the user input matches the input elements, the <tag> elements are interpreted to assign values to input variables.
Any <example> elements are ignored by the speech-recognition engine.
| Parents | Children |
|
|
| | Speech Recognition Grammar Specification: <rule> |
| | Chapter 4, XML Speech Grammar Format in the Grammar Reference. |
This rule matches one of the 3 phrases "Garibaldi", "Nassau Grouper", or "Trout":
<rule id="fish">
<one-of>
<item>Garibaldi</item>
<item>"Nassau Grouper"</item>
<item>Trout</item>
</one-of>
</rule>
This rule matches any input that ends with "trigger fish", such as "queen trigger fish", "picasso trigger fish", and "mean old trigger fish", as well as simply "trigger fish":
<rule id="trigger"> <ruleref special="GARBAGE"/> <token>Trigger Fish</token> </rule>
The following set of rules creates one public rule named snapper and two private rules named snapperType and fishColors:
<rule id="snapper" scope="public">
<ruleref uri="#snapperType"/>
<token>Snapper</token>
</rule>
<rule id="snapperType">
<token>Mutton</token>
<ruleref uri="#fishColors"/>
</rule>
<rule id="fishColors" scope="private">
<one-of>
<item>Black</item>
<item>Gray</item>
<item>Red</item>
</one-of>
</rule>
| Café Home |
Developer Agreement |
Privacy Policy |
Site Map |
Terms & Conditions Part No. 520-0001-02 | © 1999-2007, BeVocal, Inc. All rights reserved | 1.877.33.VOCAL |