规则引用 - Amazon Lex

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

规则引用

下表汇总了语法文档中可能存在的各种形式的规则引用。有关更多信息,请参阅《W3C 正式推荐标准》1.0 版语音识别语法规范中的规则引用

引用类型 XML 表单 支持
2.2.1 对本地规则的显式引用 <ruleref uri="#rulename"/>
2.2.2 对由 URI 标识的语法的命名规则的显式引用 <ruleref uri="grammarURI#rulename"/>
2.2.2 对由 URI 标识的语法的根规则的隐式引用 <ruleref uri="grammarURI"/>
2.2.2 对由具有媒体类型URI 标识的语法的命名规则的显式引用 <ruleref uri="grammarURI#rulename" type="media-type"/>
2.2.2 对由具有媒体类型URI 标识的语法的根规则的隐式引用 <ruleref uri="grammarURI" type="media-type"/>
2.2.3 特殊规则定义

<ruleref special="NULL"/>

<ruleref special="VOID"/>

<ruleref special="GARBAGE"/>

备注

  1. 语法 URI 是一个外部 URI。例如,http://grammar.example.com/world-cities.grxml

  2. 媒体类型可以是:

    • application/srgs+xml

    • text/plain

示例

<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>