question

FranciscoRamos-7328 avatar image
0 Votes"
FranciscoRamos-7328 asked YutongTie-MSFT edited

Change Azure Speech Recognition Language


Hi,

Is it possible to change the SpeechRecognizer's language at runtime after the recognizer has been created. If for example I start the recognition with English specified and I want it changed to Spanish? I saw that the recognizer has a "SpeechRecognitionLanguage" property but it's readonly.

If not possible, would the correct way to approach be to tear down the first recognizer, create a second recognizer with the new language and switch to it?

Thanks.

azure-speech
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

YutongTie-MSFT avatar image
0 Votes"
YutongTie-MSFT answered

Hello @FranciscoRamos-7328

Thanks for reching out to us. I think you are mentioning how to set the recognizer's source lanague in Speech SDK. When you created a recoginizer, I don't think you can change it. But you can easily create a new one. The langage config we are using is "source_language_config" for Python.

You need to set the language as below - Python:

 source_language_config = speechsdk.languageconfig.SourceLanguageConfig("de-DE")
 speech_recognizer = speechsdk.SpeechRecognizer(
         speech_config=speech_config, source_language_config=source_language_config, audio_config=audio_config)

C#:

 var sourceLanguageConfig = SourceLanguageConfig.FromLanguage("de-DE");
 var recognizer = new SpeechRecognizer(speechConfig, sourceLanguageConfig, audioConfig);

JAVA:

 SourceLanguageConfig sourceLanguageConfig = SourceLanguageConfig.fromLanguage("de-DE");
 SpeechRecognizer recognizer = new SpeechRecognizer(speechConfig, sourceLanguageConfig, audioConfig);

I hope this helps.

Please let me know if you need further help, we are glad to help.

Regards,
Yutong

-Please kindly accept the answer if you feel helpful, thanks.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.