O'Reilly logo

Windows® Phone 8 Unleashed by Daniel Vaughan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Recognizing Speech with Phrase List Grammars

Using a list grammar in your app requires the creation of a collection of strings that represent recognizable phrases, which is then passed to the SpeechRecognizer’s grammar set, like so:

string[] numbers = {"one", "two", "three"};SpeechRecognizerUI recognizerUI = new SpeechRecognizerUI();SpeechGrammarSet grammarSet = recognizerUI.Recognizer.Grammars;grammarSet.AddGrammarFromList("Numbers", numbers);

A speech recognizer is not limited to a single grammar. Multiple list grammars may be added to the same grammar set using successive calls to AddGrammarFromList. AddGrammarFromList accepts a key, which allows you to disable or enable the particular phrase list, and an IEnumerable<string> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required