voicexml输出外部语法并重新填充field元素

发布于 2024-10-11 00:06:31 字数 540 浏览 6 评论 0原文

我希望,如果用户说“帮助”,则以下字段不会被填充,并且用户会获得所有可能的选项。

<form id="test">    
    <field name="var1">


<prompt bargein="true" bargeintype="hotword" >say xy </prompt>

<grammar src = "grammar.grxml" type="application/srgs+xml"  />



    <filled>
    <assign name="myProdukt" expr="var1" />
    you said <value expr="myProdukt"/>
    </filled>

</field>

(假设外部语法是“p1”、“p2”和“p3”,用户说“help”,系统说“p1”、“p2”、“p3”,用户可以再次选择 - 因此“帮助”一词也必须出现在外部语法中,不是吗?)

提前致谢

I would like, that if the user says "help" that the following field doesn't get filled, and that the user gets all possible options.

<form id="test">    
    <field name="var1">


<prompt bargein="true" bargeintype="hotword" >say xy </prompt>

<grammar src = "grammar.grxml" type="application/srgs+xml"  />



    <filled>
    <assign name="myProdukt" expr="var1" />
    you said <value expr="myProdukt"/>
    </filled>

</field>

(let's say in the external grammar is "p1", "p2" and "p3", the user says "help", and the systems says "p1","p2","p3" and the user can choose again - therefore the word "help" has to be in the external grammar as well, doesn't it?)

thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我ぃ本無心為│何有愛 2024-10-18 00:06:31

是的,活动语法必须包含返回值“help”的“help”话语。然后,您可以使用 help 标记捕获该事件:

<?xml version="1.0" encoding="UTF-8"?>
<vxml xmlns="http://www.w3.org/2001/vxml" version="2.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.w3.org/2001/vxml http://www.w3.org/TR/voicexml20/vxml.xsd">
    <form id="test">    
        <field name="var1">
            <prompt bargein="true" bargeintype="hotword" >say xy </prompt>
            <grammar src = "grammar.grxml" type="application/srgs+xml"  />
            <filled>
                <assign name="myProdukt" expr="var1" />
                you said <value expr="myProdukt"/>
            </filled>
            <help>
                To choose a product, say, 
                <!-- whatever the product choices are -->
                frobinator, submarine, curling iron, .. 
                <reprompt/>
            </help>
        </field>
    </form>
</vxml>

或者,按照 DRY 原则,可以使用包含链接应用程序根文档为您的应用程序全局实现此效果> 元素。在下面的示例 app-root.vxml 文档中,有一个链接将全局语法“help”话语绑定到 help 事件

<?xml version="1.0"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
   <link event="help">
      <grammar mode="voice" root="root_rule" tag-format="semantics/1.0"
               type="application/srgs+xml" version="1.0" xml:lang="en-US">
            <rule id="root_rule" scope="public">
                  <one-of>
                        <item weight="1.0">
                              help
                        </item>
                  </one-of>
            </rule>
      </grammar>
   </link>
</vxml>

:语法将在任何地方都是活跃的——有效地与每个活跃的领域语法合并。如果您需要有关应用程序根文档的更多信息,请参阅 VoiceXML 规范执行部分多文档应用程序解释了这一点。另请参阅 Tellme 中的处理事件 Studio 文档

然后,在应用程序的页面中,通过 vxml 元素的 application 属性引用应用程序根文档,并在 >help catch 块:

<?xml version="1.0" encoding="UTF-8"?>
<vxml xmlns="http://www.w3.org/2001/vxml" version="2.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.w3.org/2001/vxml http://www.w3.org/TR/voicexml20/vxml.xsd"
    application="app-root.vxml">
    <form id="test">    
        <field name="var1">
            <prompt bargein="true" bargeintype="hotword" >say xy </prompt>
            <grammar src = "grammar.grxml" type="application/srgs+xml"  />
            <filled>
                <assign name="myProdukt" expr="var1" />
                you said <value expr="myProdukt"/>
            </filled>
            <help>
                To choose a product, say, 
                <!-- whatever the product choices are -->
                frobinator, submarine, curling iron, .. 
                <reprompt/>
            </help>
        </field>
    </form>
</vxml>

当然,您可以将 link 代码与表单放在同一页面中,但您可能希望 help 处于活动状态适用于应用程序的每个领域,除非与特定领域的语法中的某些内容发生冲突。

Yes, the active grammar must contain a "help" utterance which returns the value 'help'. You then catch the event with a help tag:

<?xml version="1.0" encoding="UTF-8"?>
<vxml xmlns="http://www.w3.org/2001/vxml" version="2.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.w3.org/2001/vxml http://www.w3.org/TR/voicexml20/vxml.xsd">
    <form id="test">    
        <field name="var1">
            <prompt bargein="true" bargeintype="hotword" >say xy </prompt>
            <grammar src = "grammar.grxml" type="application/srgs+xml"  />
            <filled>
                <assign name="myProdukt" expr="var1" />
                you said <value expr="myProdukt"/>
            </filled>
            <help>
                To choose a product, say, 
                <!-- whatever the product choices are -->
                frobinator, submarine, curling iron, .. 
                <reprompt/>
            </help>
        </field>
    </form>
</vxml>

Alternatively, following the DRY principle, this effect can be done globally for your application with using an application root document containing a link element. In the example app-root.vxml document below, there is a linkbinding a global grammar "help" utterance to the help event :

<?xml version="1.0"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
   <link event="help">
      <grammar mode="voice" root="root_rule" tag-format="semantics/1.0"
               type="application/srgs+xml" version="1.0" xml:lang="en-US">
            <rule id="root_rule" scope="public">
                  <one-of>
                        <item weight="1.0">
                              help
                        </item>
                  </one-of>
            </rule>
      </grammar>
   </link>
</vxml>

This grammar will be active everywhere -- effectively merged with each active field grammar. If you need more information about application root documents, the section of the VoiceXML specification Executing a Multi-Document Application explains. Also see Handling Events from the Tellme Studio documentation

Then, in pages of your application, make reference to the application root document via the application attribute of the vxml element and speak appropriately in a help catch block:

<?xml version="1.0" encoding="UTF-8"?>
<vxml xmlns="http://www.w3.org/2001/vxml" version="2.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.w3.org/2001/vxml http://www.w3.org/TR/voicexml20/vxml.xsd"
    application="app-root.vxml">
    <form id="test">    
        <field name="var1">
            <prompt bargein="true" bargeintype="hotword" >say xy </prompt>
            <grammar src = "grammar.grxml" type="application/srgs+xml"  />
            <filled>
                <assign name="myProdukt" expr="var1" />
                you said <value expr="myProdukt"/>
            </filled>
            <help>
                To choose a product, say, 
                <!-- whatever the product choices are -->
                frobinator, submarine, curling iron, .. 
                <reprompt/>
            </help>
        </field>
    </form>
</vxml>

You could, of course, put the link code in the same page as your form, but it is likely you will want help active for every field of your application unless there is collision with something in a particular field's grammar.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文