我正在使用语音识别运行示例,但无法在Windows 8或2012服务器上运行。
使用win8或win2012server,以下代码不会返回记录,但在win7中会返回记录。
foreach(RecognizerInfo rec in System.Speech.Recognition.SpeechRecognitionEngine.InstalledRecognizers())
{
Console.WriteLine(rec.Culture);
}
如果我使用通过win8或win2012服务器使用的LoadGrammar,则会引发异常:
_recognizer.LoadGrammar (new Grammar (new GrammarBuilder (new Choices (_numbersGrammar.Keys.ToArray ()))) { Name = "Numbers_Grammar" });
'System.PlatformNotSupportedException',表示未安装识别器。
堆栈跟踪:
System.Speech.Recognition.RecognizerBase.Initialize(SapiRecognizer识别器,布尔inproc)em System.Speech.Recognition.SpeechRecognitionEngine.get_RecoBase()em System.Speech.Recognition.SpeechRecognictionEngine.LoadGrammar(Grammar grammar .... cs:行289中的Int32 lettersCount,Int32 waitMilliseconds),SpeechRecognition.Program.Main(String [] args)na e:\ TestCenter \ SpeechRecognition \ SpeechRecognition \ Program.cs:linha 24 em System.AppDomain._nExecuteAssembly( Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()中的RuntimeAssembly程序集,String [] args)
em System.Threading.ExecutionContext.RunInternal(ExecutionContextexecutionContext,ContextCallback回调,对象状态,布尔类型的preserveSyncCtx)em System.Threading.ExecutionContext.Run(ExecutionContext执行上下文,ContextCallback回调,对象状态,布尔值saveSyncCtx)em System.Threading.ExecutionContext.Run (ExecutionContext executeContext,ContextCallback回调,对象状态)em System.Threading.ThreadHelper.ThreadStart()
我必须安装什么?我尝试安装Speech SDK 11,但是直到完成oO时它才会关闭
有人知道与此操作系统不兼容吗?
有人知道另一个lib可以做到这一点吗?
谢谢!
您正在使用System.Speech
用于Speech SDK 5.3 / 5.4的名称空间,而应该使用的Microsoft.Speech
是Speech SDK 11的名称空间,并且可以在以下位置找到其程序集
“ C:\ Program Files \ Microsoft SDKs \ Speech \ v11.0 \ Assembly \ Microsoft.Speech.dll”
如果将其安装到默认路径。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句