如何加载XML语法进行语音识别 [英] How do I load XML Grammars for speech recognition
本文介绍了如何加载XML语法进行语音识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用System.Speech创建一个使用语音识别的应用程序。我想加载以XML格式存储的语法。我无法弄清楚该怎么做。我发现的一些事情说xml语法不能与System.Speech一起使用,但可以与SAPI一起使用。我找不到任何显示如何执行c#SAPI应用程序的内容。
我需要能够使用xml语法实现语音识别。我非常感谢能够帮助我实现这一目标的任何人。
I am trying to create an application that uses speech recognition using System.Speech. I want to load a grammar that has been stored in XML format. I can't figure out how to do it. Some things I have found say that xml grammars can not be used with System.Speech but can be used with SAPI. I can not find anything that shows how to do a c# SAPI application.
I need to be able to implement speech recognition using xml grammars. I would very much appreciate anyone that can help me achieve that goal.
推荐答案
如果XML文件遵循 SRGS规范 [ ^ ],你可以:
If the XML file follows the SRGS specification[^], you can:
Grammar gr = new Grammar(@"path\to\grammar.xml");
这篇关于如何加载XML语法进行语音识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文