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> ...

Get Windows® Phone 8 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.