voicexml 中外部语法的结构
外部 vxml 语法的结构是什么样的?
目前我有以下内联语法:
<grammar root="main" version="1.0" xml:lang="de-DE">
<rule id="main" scope="public">
<one-of>
<item> 1 </item>
<item> 2 </item>
<item>3 </item>
<item> 4</item>
</one-of>
</rule>
</grammar>
我想编写
<grammar src = "mygrammar.grxml" type="application/srgs+xml" />
并引用外部语法,而不是这个内联语法。
我可以复制内联语法并将其放入 mygrammer.grxml 中吗?
或者我需要更多的代码行吗?
提前致谢
----编辑----
现在我的内联语法早些时候在哪里,我有
<grammar src = "grammar_produkte.grxml" type="application/srgs+xml" />
,我的外部语法看起来像这样(就像你说的):
<?xml version="1.0" ?>
<grammar root="main" version="1.0" xml:lang="de-DE">
<rule id="main" scope="public">
<one-of>
<item> 1 </item>
<item> 2 </item>
<item> 3 </item>
<item> 4 </item>
</one-of>
</rule>
</grammar>
但它不起作用。它表示发生错误并且应用程序停止。 我做错了什么吗? 该文件与 .vxml 位于同一目录中。
我使用 MS Speech Server 2007
----------------编辑-----
你好,
我引用的语法文件是:
<grammar src = "grammar_produkte2.grxml" type="application/srgs+xml" />
除了我之前使用的语法之外,现在我使用这个示例(来自网站):
<?xml version="1.0"?>
<grammar xml:lang="de-DE"
tag-format="semantics-ms/1.0" version="1.0"
root="Root" mode="voice"
xmlns="http://www.w3.org/2001/06/grammar"
xmlns:sapi=
"http://schemas.microsoft.com/
Speech/2002/06/SRGSExtensions">
<rule id="produkte" scope="public">
<one-of>
<item>
<item>ham</item>
<tag>$._value = "ham"</tag>
</item>
<item>
<item>roast beef</item>
<tag>$._value = "roast beef"</tag>
</item>
<item>
<item>italian</item>
<tag>$._value = "italian"</tag>
</item>
</one-of>
</rule>
</grammar>
我尝试使用 mode=voice 和 dtmf。
除了语音服务器之外,我还需要什么吗? 文件位于同一文件夹中。
how does the structure of an external vxml grammar looks like?
at the moment i have following inline grammar:
<grammar root="main" version="1.0" xml:lang="de-DE">
<rule id="main" scope="public">
<one-of>
<item> 1 </item>
<item> 2 </item>
<item>3 </item>
<item> 4</item>
</one-of>
</rule>
</grammar>
instead of this inline grammar i want to write
<grammar src = "mygrammar.grxml" type="application/srgs+xml" />
and refer to the external grammar.
can I just copy the inline grammar and put it in mygrammer.grxml?
or do I need somemore lines of code?
thanks in advance
----EDIT----
now where earlier my inline grammar was, i have
<grammar src = "grammar_produkte.grxml" type="application/srgs+xml" />
and my external grammar looks like this (like you said):
<?xml version="1.0" ?>
<grammar root="main" version="1.0" xml:lang="de-DE">
<rule id="main" scope="public">
<one-of>
<item> 1 </item>
<item> 2 </item>
<item> 3 </item>
<item> 4 </item>
</one-of>
</rule>
</grammar>
but it doesn't work. It says, that an error occurred and that the application stops.
Did i do something wrong?
The file is in the same directory like the .vxml.
I Use MS Speech Server 2007
----------------Edit-------
Hello,
I'm referencing to the grammar file with:
<grammar src = "grammar_produkte2.grxml" type="application/srgs+xml" />
In addition to the grammar i used before, now I use this example (from the website):
<?xml version="1.0"?>
<grammar xml:lang="de-DE"
tag-format="semantics-ms/1.0" version="1.0"
root="Root" mode="voice"
xmlns="http://www.w3.org/2001/06/grammar"
xmlns:sapi=
"http://schemas.microsoft.com/
Speech/2002/06/SRGSExtensions">
<rule id="produkte" scope="public">
<one-of>
<item>
<item>ham</item>
<tag>$._value = "ham"</tag>
</item>
<item>
<item>roast beef</item>
<tag>$._value = "roast beef"</tag>
</item>
<item>
<item>italian</item>
<tag>$._value = "italian"</tag>
</item>
</one-of>
</rule>
</grammar>
I tried it with mode=voice and dtmf.
Do I need anything else expect the speech server?
The Files are in the same folder.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您至少需要 XML 声明(条目)。文档类型通常是可选的(对于某些解析器,最好避免)。对于大多数语法来说,大多数其他属性也可以避免。
以下内容来自 SRGS(语法)规范 中的示例:
在您的具体示例中,对于大多数平台,以下内容应该足够了:
上面,我提到 doctype 在某些情况下是一个问题。我发现一些系统可以连续获取 DTD(如果列出)。这是不好的形式,但并不总是被注意到。如果互联网链接出现故障,系统将无法正确响应。而且,如果您的流量足够大,您可能会被识别为 DOS 攻击并被封锁一段时间。
At a minimum you'll need the XML declaration ( entry). Doctypes are usually optional (and for some parsers, you're better off avoiding). Most of the other attributes, for most grammars, can also be avoided.
The following is from an example in the SRGS (grammar) specification:
In your specific example, and for most platforms, the following should be sufficient:
Above, I mentioned doctype being a problem in some cases. I've found some systems that continuously fetch DTDs if listed. This is bad form, but not always noticed. If the Internet link goes down, the system doesn't respond correctly. And, if you have enough volume, you may be identified as a DOS attack and get blocked for a period of time.