Speech Recognition PlatformNotSupportedException

2020-04-19 08:36发布

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条回答
神经病院院长
2楼-- · 2020-04-19 08:47

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.

查看更多
登录 后发表回答