Change the language of Speech Recognition Engine library

若如初见. 提交于 2019-12-29 07:53:08

问题


I am working on a program (in C#) to recognize voice commands from the user and execute in the PC, i.e. the user says "start menu" and the PC opens the start menu.

I have find a cool library: SpeechRecognitionEngine for the speech recognition, the problem is that I need to recognize spanish language too, is there any way to change the language?


回答1:


You can use the SpeechRecognitionEngine(CultureInfo) overload.

var speechRec = new SpeechRecognitionEngine(new CultureInfo("es-ES")));

This assumes that the user has the Spanish culture installed, otherwise an ArgumentException will be thrown. The SpeechRecognitionEngine class implements IDisposable, so it's a good idea to call speechRec.Dispose() when you're done, or use it in a using statement.



来源:https://stackoverflow.com/questions/13981294/change-the-language-of-speech-recognition-engine-library

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