如何禁用 VoiceXML 语法?

发布于 2024-07-09 21:06:15 字数 275 浏览 7 评论 0原文

我正在编写一个 VoiceXML 应用程序,其中我们有语音语法和 DTMF 语法。 如果呼叫者是在特别嘈杂的环境中呼叫的,我们需要禁用语音语法。 有没有一种方法可以做到这一点,而不涉及将整个表单复制到另一个表单并删除语音语法?

I'm writing a VoiceXML application where we have a speech grammar and a DTMF grammar. If the caller is calling from a particularly noisy environment, we need to disable the speech grammar. Is there a way to do this which doesn't involve copying the entire form into another form and deleting the speech grammar?

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

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

发布评论

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

评论(3

撩发小公举 2024-07-16 21:06:15

您正在寻找的可能是 inputmodes 属性:

<property name="inputmodes" value="dtmf"/>

这将启用 DTMF 语法,同时禁用语音语法。

What you're looking for is probably the inputmodes property:

<property name="inputmodes" value="dtmf"/>

This will enable the DTMF grammar while the voice grammar is disabled.

尛丟丟 2024-07-16 21:06:15

您没有提及您正在使用哪个平台,但这很重要,因为这是平台之间存在差异的领域之一。

VoiceXMl 2.0 规范的 [3.1.4][1] 节表示 inputmodes="dtmf" 不会停用语音语法,而只是使它们无法匹配。 因此,如果您关闭语音识别语法,您会希望结束指针不允许语音插入,但这不一定是规范所禁止的。

除非您可以使用任何特定于平台的扩展,您还可以考虑敏感度属性。 将其设置为 0 将使 ASR 停止监听语音。

如果您的平台支持,您还可以尝试将 bargeintype 属性设置为“hotword”。 这不会禁用语音语法,但会降低用户因与噪声相关的插入声音而听不到提示的可能性,而噪声有时足以使应用程序正常运行。

You don't mention which platform(s) you're using, but it's important because this is one of those areas where you have variation between platforms.

Section [3.1.4][1] of the VoiceXMl 2.0 spec says that inputmodes="dtmf" does not de-activate speech grammars, but merely makes it impossible for them to be matched. So, if you turn off the speech recognition grammars, you would hope that the end pointer wouldn't allow speech bargein, but it isn't necessarily forbidden by the spec.

Barring any platform-specific extensions you can use, you might also consider the sensitivity property. Setting that to 0 should make the ASR stop listening for speech.

You could also try setting the bargeintype property to "hotword", if your platform supports it. This won't disable the speech grammars, but it will make it less likely that users won't hear the prompts due to noise-related bargein which is sometimes enough to make the application work.

撩起发的微风 2024-07-16 21:06:15

使用输入模式可以工作,但您仍然需要两种形式。 但是,如果您使用 voicexml 2.1 并确保不在语法标记中提供输入 mod 并确保在语法本身中指定它,则可以使用 srcexpr 来“关闭”语音语法。

假设您这样指定语法:

<grammar type="application/srgs+xml" src="/grammars/menu.grxml" />
<grammar type="application/srgs+xml" src="/grammars/menu-dtmf.grxml" />

您可以通过重复使用 dtmf 版本来禁用语音语法:

<grammar type="application/srgs+xml" srcexpr="'/grammars/menu' + (dtmfMode?'-dtmf':'') + '.grxml'" />
<grammar type="application/srgs+xml" src="/grammars/menu-dtmf.grxml" />

因此,您所需要做的就是设置一个名为 dtmfMode 的布尔变量,当您只需要 DTMF 时,该变量为 true。

Using inputmodes can work but you'll still need two forms. There is, however, a work around if you are using voicexml 2.1 and make sure you do not provide the input mod in the grammar tag and make sure it's specified in the grammar itself then you can use a srcexpr to "turn off" your speech grammar.

Say you specify your grammars thus:

<grammar type="application/srgs+xml" src="/grammars/menu.grxml" />
<grammar type="application/srgs+xml" src="/grammars/menu-dtmf.grxml" />

You can disable the speech grammar by repeating the use of the dtmf version:

<grammar type="application/srgs+xml" srcexpr="'/grammars/menu' + (dtmfMode?'-dtmf':'') + '.grxml'" />
<grammar type="application/srgs+xml" src="/grammars/menu-dtmf.grxml" />

So all you need to do is set a boolean variable called dtmfMode that is true when you only want DTMF.

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