Change the language of Speech Recognition Engine library

前端 未结 1 1710
忘了有多久
忘了有多久 2020-12-19 16:16

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.

相关标签:
1条回答
  • 2020-12-19 17:11

    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.

    0 讨论(0)
提交回复
热议问题