VXML:定义具有同等输入的语法
-
02-10-2019 - |
题
我正在使用基于Tellme的引擎。我已经看到了语法示例,用户可以说一些被认为是相同的不同内容之一。但是,我见过的所有示例都是用于在线语法(不适用于VXML引擎IM使用的)。我想知道如何更改我的.grxml文件来执行此操作。这是文件:
<?xml version="1.0"?>
<!-- created by Matthew Murdock. Grammars for speech rec menus -->
<grammar xmlns="http://www.w3.org/2001/06/grammar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd" xml:lang="en" version="1.0" mode="voice" scope="dialog" tag-format="semantics/1.0.2006">
<rule id="keep">
<one-of>
<item>exit</item>
<item>exit the system</item>
<item>another</item>
<item>another mailbox</item>
<item>play</item>
<item>play back</item>
</one-of>
</rule>
</grammar>
我没有有6个项目,而是要有3个项目,每个项目都有两个可能的话。关于我如何做的任何想法?
解决方案 3
我想到了。我改变了语法,看起来像这样:
<?xml version="1.0"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd" xml:lang="en" version="1.0" mode="voice" scope="dialog" tag-format="semantics/1.0-literals">
<rule id="keep">
<one-of>
<item><ruleref id="#exit"/></item>
<item><ruleref id="#play"/></item>
</one-of>
</rule>
<rule id="exit">
<one-of>
<item>exit</item>
<item>exit the system</item>
</one-of>
<tag>out.result = "exit"</tag>
</rule>
<rule id="play">
<one-of>
<item>play</item>
<item>play back</item>
</one-of>
<tag>out.result = "play"</tag>
</rule>
</grammar>
然后,返回我的脚本,而不是将我的操作基于CallerInput(在 <field>
标签),我将它们基于CallerInput $。解释,该解释包含XML包含我分配的所有内容。 <tag>
语法元素。
我想将您的动作以“解释”为基础是有意义的,而不是呼叫者的字面意见。
注意:由于我们正在使用自己的VXML引擎,因此我们能够创建一种从XML中提取解释值的方法。
其他提示
更紧凑的形式:
<rule id="exit">
exit <item repeat="0-1">the system</item>
<tag>out.result = "exit"</tag>
</rule>
<rule id="play">
play <item repeat="0-1">back</item>
<tag>out.result = "play"</tag>
</rule>
您想要的答案是 sisr 规范提供了将含义附加到输入路径上的机制。重写您的示例:
<?xml version="1.0"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd" xml:lang="en" version="1.0" mode="voice" scope="dialog" tag-format="semantics/1.0-literals">
<rule id="keep">
<one-of>
<item>
<one-of>
<item>exit</item>
<item>exit the system</item>
</one-of>
<tag>exit</tag>
</item>
<item>
<one-of>
<item>another</item>
<item>another mailbox</item>
</one-of>
<tag>another</tag>
</item>
<item>
<one-of>
<item>play</item>
<item>play back</item>
</one-of>
<tag>play</tag>
</item>
</one-of>
</rule>
</grammar>
要知道的几件事:
- 我选择了字面的标签格式(请注意语法元素的标签式属性)。它也可以使用“语义/1.0”实现,并且标签的内容看起来像:out =“ exit”;
- tellme tag-format值可能需要不同,但是 开发指南 意味着他们遵循标准。
- 一旦工作起作用,请随时创建填充语法(在SRGS中,规则)。填充规则将是没有任何SI(没有标签元素)的规则,并包含人们添加回答的常见短语。例如,可以在语法结束时添加的尾随规则:
</one-of> <item repeat="0-1"><ruleref uri="#trailing"/></item> </rule> <rule id="trailing> <one-of> <item>please</item> <item>thank you</item> </one-of> </rule> </grammar>
这将支持更多自然的响应。根据您的呼叫基础,这可能很重要。填充语法可能非常大,但往往是高度重复使用的。您还可以在输入开始时添加填充剂。在丰富的语音应用中,调整过程中最重要的收益涉及更新语法,以包含呼叫者所说的实际短语与开发人员或VUI设计师认为会说什么。
不隶属于 StackOverflow