How can I programmatically set SAPI recognizer
-
05-07-2021 - |
Pregunta
I am developing a C# application using SAPI 5.4 that allows users to select one of several different languages for speech recognition.
If I go to Control Panel -> Speech Recognition -> Advanced Speech Options I can change the recognizer language from "Microsoft Speech Recognizer 8.0 for Windows (English - US)" to "Microsoft Speech Recognizer 8.0 for Windows (French - France)" for example. This allows my application to now recognize speech in French instead of English.
Is there a way to programmatically select the correct recognizer at run time without requiring the user to go into the control panel?
I suspect it might have something to do with tokens, but I can't seem to find any examples.
Any help is much appreciated.
Solución
You can specify a culture when you call the constructor of an in-proc recognizer (SpeechRecognitionEngine Class), see http://msdn.microsoft.com/en-us/library/ms554259.aspx for desktop OS and http://msdn.microsoft.com/en-us/library/dd130099.aspx for Microsoft Speech Platform.
I don't think you can do this programmatically with a shared recognizer (SpeechRecognizer Class). See What is the difference between System.Speech.Recognition and Microsoft.Speech.Recognition? for some more info.