0

I am using an engine based on TellMe. I have seen examples of grammars where the user can say one of a few different things that are considered the same. However, all the examples i've seen have been for in-line grammars (which dont work with the vxml engine im using). I want to know how i can change my .grxml file to do this. This is the file:

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

instead of having 6 items, i want to have 3 items, each having two possible utterances. Any ideas on how i can do this?

4

3 回答 3

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>
于 2010-08-24T17:29:45.677 回答
0

I figured it out. I changed my grammar to look like this:

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

Then, back in my script instead of basing my actions on callerInput (the variable specified in the <field> tag), i based them off of callerInput$.interpretation which holds xml containing whatever i assigned out.result to in the <tag> element of the grammar.

I guess it makes sense to base your actions on the "interpretation" and not the caller's literal input.

NOTE: Because we are working with our own vxml engine we were able to create a method for extracting the interpretation value out of the xml.

于 2010-07-13T16:46:59.103 回答
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>

有几件事要知道:

  • 我选择了文字标签格式(注意语法元素的标签格式属性)。它也可以使用“semantics/1.0”实现,标签的内容看起来像:out="exit";
  • TellMe 标记格式值可能需要不同,但它们的开发指南暗示它们遵循标准。
  • 一旦你让它工作,不要犹豫创建填充语法(在 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 设计者认为会说的内容。

于 2010-07-08T12:14:04.883 回答