Speech Recognition PlatformNotSupportedException

孤者浪人 提交于 2019-12-02 08:19:30

问题


I'm running a sample using speech recognition and it´s not working on windows 8 or 2012 server.

Using win8 or win2012server the following code doesn´t return records, but it does in win7.

foreach(RecognizerInfo rec in System.Speech.Recognition.SpeechRecognitionEngine.InstalledRecognizers())
    {
        Console.WriteLine(rec.Culture);
    }

If I use a LoadGrammar using win8 or win2012 server it raises an exception:

_recognizer.LoadGrammar (new Grammar (new GrammarBuilder (new Choices (_numbersGrammar.Keys.ToArray ()))) { Name = "Numbers_Grammar" });

'System.PlatformNotSupportedException' saying that no recognizer was installed.

StackTrace:

System.Speech.Recognition.RecognizerBase.Initialize(SapiRecognizer recognizer, Boolean inproc) em System.Speech.Recognition.SpeechRecognitionEngine.get_RecoBase() em System.Speech.Recognition.SpeechRecognitionEngine.LoadGrammar(Grammar grammar) em SpeechRecognition.CaptchaSpeechManager..ctor(Int32 lettersCount, Int32 waitMilliseconds) in ....cs:line 289 em SpeechRecognition.Program.Main(String[] args) na e:\TestCenter\SpeechRecognition\SpeechRecognition\Program.cs:linha 24 em System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
em System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) em System.Threading.ThreadHelper.ThreadStart()

What do I have to install? I tried to install Speech SDK 11 but it closes until completition oO

Does anybody know any incompatibility with this OSs?

Does anybody know another lib to do this?

Thanks!


回答1:


You are using System.Speech namespace which is used for Speech SDK 5.3/5.4, while you should be using Microsoft.Speech which is the Speech SDK 11 one and you can find its assembly in

"C:\Program Files\Microsoft SDKs\Speech\v11.0\Assembly\Microsoft.Speech.dll"

if you install it to the default path.



来源:https://stackoverflow.com/questions/25690938/speech-recognition-platformnotsupportedexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!