2010-07-07 73 views
0

我使用基于TellMe的引擎。我已经看到了语法的例子,用户可以说一些被认为是相同的不同事物之一。然而,我见过的所有例子都是用于内联语法的(它们不使用vxml引擎)。我想知道如何更改我的.grxml文件来执行此操作。这是档案:vxml:用等价输入定义语法

<?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个项目,每个有两个可能的发言。任何想法如何我可以做到这一点?

+0

虽然并不常见(如果连使用)标签上的SO,可能值得加入SRGS和SISR的标签列表。还有一些VoiceXML开发人员在这里提出问题,有人可能会从中获得价值。 – 2010-07-08 12:16:48

回答

0

我想通了。我改变了我的语法看起来像这样:

<?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 $ .interpretation持有xml包含我在文法的<tag>元素中分配的所有结果。

我想你的行动基于“解释”而不是调用者的文字输入是有意义的。

注意:因为我们正在使用我们自己的vxml引擎,所以我们能够创建一个方法来从xml中提取解释值。

0

您想要的答案在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标签格式值可能需要不同,但它们的development guide意味着它们遵循标准。
  • 一旦你有它的工作,不要犹豫,以创建填充文法(在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设计者认为会说出的内容。

+0

很抱歉,您的建议无效。''不能是TellMe或我的引擎中''的孩子。如果有帮助,我正在使用Lumenvox进行语音识别。 – mtmurdock 2010-07-08 15:04:57

+0

你是对的。内部元素必须包装在元素中。 – 2010-07-08 22:47:13

2

更紧凑的形式:

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