In one of the previous article, we saw how to use the Phrase List Grammars via the array of string for the speech recognition in Windows Phone Apps.
Below is a code snippet demonstrating How to use Phrase List Grammars (List) for recognizing Speech in Windows Phone Apps?
How to use Phrase List Grammars (List) for recognizing Speech in Windows Phone Apps?
async private void Button_Click_1(object sender, RoutedEventArgs e) { SpeechRecognizerUI speech = new SpeechRecognizerUI(); List<string> days = new List<string>(){ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }; speech.Recognizer.Grammars.AddGrammarFromList("Days", days); SpeechRecognitionUIResult result = await speech.RecognizeWithUIAsync(); if (result.ResultStatus == SpeechRecognitionUIStatus.Succeeded) { MessageBox.Show(result.RecognitionResult.Text); } }
Leave a Reply