voice srgs语法相关

grxml:使用xml书写srgs的方式
abnf:rfc5234规范,
现在,几乎每一位新编程语言书籍的作者都使用巴科斯范式来定义编程语言的语法规则。
例如sql语法帮助也是用这个来描述的。
然而srgs中的abnf是混合bnf和abnf的语法,例如或|是bnf写法,/被改做为权重, =又是abnf写法,bnf写法是:=

-------------------------------------------abnf双模式示例
#ABNF 1.0 UTF-8;

language en;
mode voice;
root $basicCmd;

public $basicCmd = (dtmf-1 | yes) {y} | (dtmf-2 | no) {n};


------------------------------------------------------------------------

在voice中既然后台具备自然语言处理的能力,就不应该使用tag而应该直接返回所有匹配项。

$object = [the | a] (window | file | menu);
这样的写法用户说了the就会返回the,没说就不会返回the,所以都用[]比较好。
$object = [the | a] [window | file | menu];

--------------------------------------------------------------------------

grxml

item下面可以有ruleref但不能是rule

<rule id="r_3">
        <one-of>
            <item>
                <tag><![CDATA[Yes]]></tag>    //可以
                <ruleref uri="#r_4" />
            </item>
            <item>
                <tag><![CDATA[No]]></tag>
                <ruleref uri="#r_5" />
            </item>
        </one-of>
    </rule>

item在下面放one-of是可以的
<rule id="r_0">
        <one-of>
            <item>
                <tag><![CDATA[__QUERY__]]></tag>
                <item repeat="1-">
                    <one-of>
                        <item>what</item>
                        <item>who</item>
                        <item>where</item>
                        <item>how</item>
                        <item>why</item>
                        <item>whom</item>
                    </one-of>
                </item>
                <item repeat="0-">
                    <one-of>
                        <item>is</item>
                        <item>are</item>
                        <item>were</item>
                        <item>does</item>
                        <item>do</item>
                        <item>did</item>
                        <item>will</item>
                        <item>would</item>
                        <item>shall</item>
                        <item>should</item>
                        <item>may</item>
                        <item>might</item>
                    </one-of>
                </item>
                <item>
                    <ruleref special="GARBAGE" />
                </item>
            </item>
        </one-of>
    </rule>


Total views.

© 2013 - 2024. All rights reserved.

Powered by Hydejack v6.6.1