The List grammars is one of the grammars that the developers can use to create their own custom grammars. With this technique, simply create an array or collection of strings which are the phrase list and set it to the grammars list of the SpeechRecognizer Object.
How to use Phrase List Grammars for recognizing Speech in Windows Phone Apps?
Below is a code snippet demonstrating How to use Phrase List Grammars via array of strings for recognising Speech in Windows Phone Apps.
async private void Button_Click_1(object sender, RoutedEventArgs e) { SpeechRecognizerUI speech = new SpeechRecognizerUI(); string[] days = { "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