How to Set Different Language for the Speech recognizer in Windows Phone 8 App?

In this blog post, we will see how to set different language for the speech recognizer in Windows Phone 8 App.

When a new instance of the SpeechRecognizerUI is created, the Speech API will load the recognizer for the language that is set by the user in the Settings-> Speech App on the Windows Phone.

How to Set Different Language for the Speech recognizer in Windows Phone 8 App?

How to Set Different Language for the Speech recognizer in Windows Phone 8 App?

The developer can also specify the supported language for the SpeechRecognizer to load. In this blog post, we will look in to the API support on how to achieve this.

How to Set Different Language for the Speech recognizer in Windows Phone 8 App?

The SpeechRecognizerUI exposes the property “Recognizer” which includes the method SetRecognizer which can be used to set the language.

async private void Button_Click_1(object sender, RoutedEventArgs e)

{

var Language = (from language in InstalledSpeechRecognizers.All

where language.Language == "de-DE"

select language).FirstOrDefault();

SpeechRecognizerUI speech = new SpeechRecognizerUI();

speech.Recognizer.SetRecognizer(Language);

await speech.RecognizeWithUIAsync();

}

For example, assume that you want to set the “German” language for the speech recognizer, simply get the SpeechRecognizerInformation from the InstalledSpeechRecognizers.All by using LINQ query filtered by the language “de-DE” and assign it to the Recognizer.SetRecognizer method of the SpeechRecognizerUI object. When you run the project and try the speech feature, you should see the speech recognizer with the German language.

How to Set Different Language for the Speech recognizer in Windows Phone 8 App?

How to Set Different Language for the Speech recognizer in Windows Phone 8 App?

Leave a Reply