Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml Kinect语音识别仅识别一条语法规则_Xml_Kinect_Speech - Fatal编程技术网

Xml Kinect语音识别仅识别一条语法规则

Xml Kinect语音识别仅识别一条语法规则,xml,kinect,speech,Xml,Kinect,Speech,我目前正在使用Microsoft Kinect SDK开发语音识别应用程序。应用程序的目标是加载包含语法的任何(有效)XML文件,并使用它来处理语音。 出于某种我还没有理解的原因,应用程序似乎只能识别XML语法文件中属于第一条规则的所有单词。例如,在以下语法中: <grammar version="1.0" xml:lang="en-US" root="rootRule" tag-format="semantics/1.0-literals" xmlns="http://www.w3.or

我目前正在使用Microsoft Kinect SDK开发语音识别应用程序。应用程序的目标是加载包含语法的任何(有效)XML文件,并使用它来处理语音。 出于某种我还没有理解的原因,应用程序似乎只能识别XML语法文件中属于第一条规则的所有单词。例如,在以下语法中:

<grammar version="1.0" xml:lang="en-US" root="rootRule" tag-format="semantics/1.0-literals" xmlns="http://www.w3.org/2001/06/grammar">
<rule id="rootRule">
<one-of>
  <item>
    <tag>PEOPLE</tag>
    <one-of>
      <item> team </item>
      <item> kara </item>
      <item> john </item>
      <item> george </item>
    </one-of>
  </item>
  <item>
    <tag>FOOD</tag>
    <one-of>
      <item> apple </item>
      <item> banana </item>
    </one-of>
  </item>
</one-of>
</rule>
<rule id="anotherRule">
<one-of>
  <item>
    <tag>COMMANDS</tag>
    <one-of>
      <item> close </item>
      <item> shut down </item>
      <item> stop the application </item>
    </one-of>
  </item>
  <item>
    <tag>TOYS</tag>
    <one-of>
      <item> doll </item>
      <item> teddy bear </item>
    </one-of>
  </item>
  </one-of>
 </rule>
</grammar>
它对第一条规则很有效,所以理论上它应该适用于以下所有规则


我正在基于一个已经存在的应用程序(两者都有完全相同的问题)开发我的应用程序,其源代码可以在以下位置找到:

您在语法元素
root=“rootRule”
中指定了根规则:


所以它以rootRule为基础。如果需要备选方案,可以在顶部构建备选方案。第二条规则可以被第一条规则引用并用于识别,例如,请参见此处:

但语法只有一个切入点,那个就是识别。这就是引擎的工作原理

spRecEng.LoadGrammar(new Grammar(filename));
 <grammar version="1.0" xml:lang="en-US" root="rootRule" tag-format="semantics/1.0-literals" xmlns="http://www.w3.org/2001/06/grammar">