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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.