Rule reference - Amazon Lex

Rule reference

The following table summarizes the various forms of rule reference that are possible within grammar documents. For more information, see Rule reference in the Speech recognition grammar specification version 1 W3C recommendation.

Reference type XML form Supported
2.2.1 Explicit local rule reference <ruleref uri="#rulename"/> Yes
2.2.2 Explicit reference to a named rule of a grammar identified by a URI <ruleref uri="grammarURI#rulename"/> No
2.2.2 Implicit reference to the root rule of a grammar identified by a URI <ruleref uri="grammarURI"/> No
2.2.2 Explicit reference to a named rule of a grammar identified by a URI with a media type <ruleref uri="grammarURI#rulename" type="media-type"/> No
2.2.2 Implicit reference to the root rule of a grammar identified by a URI with a media type <ruleref uri="grammarURI" type="media-type"/> No
2.2.3 Special rule definitions

<ruleref special="NULL"/>

<ruleref special="VOID"/>

<ruleref special="GARBAGE"/>

No

Notes

  1. Grammar URI is an external URI. For example, http://grammar.example.com/world-cities.grxml.

  2. Media type can be:

    • application/srgs+xml

    • text/plain

Example

<rule id="city" scope="public"> <one-of> <item>Boston</item> <item>Philadelphia</item> <item>Fargo</item> </one-of> </rule> <rule id="state" scope="public"> <one-of> <item>FL</item> <item>MA</item> <item>NY</item> </one-of> </rule> <!-- "Boston MA" -> city = Boston, state = MA --> <rule id="city_state" scope="public"> <ruleref uri="#city"/> <ruleref uri="#state"/> </rule>