Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Rule reference

Focus mode
Rule reference - Amazon Lex

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>
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.