GrammarBuilder::Append Method (String^, SubsetMatchingMode)
Appends an element for a subset of a phrase to the current sequence of grammar elements.
Assembly: System.Speech (in System.Speech.dll)
Parameters
- phrase
-
Type:
System::String^
The sequence of words to append.
- subsetMatchingCriteria
-
Type:
System.Speech.Recognition::SubsetMatchingMode
The matching mode the grammar uses to recognize the phrase.
The subset element is added to the end of the current sequence of elements. For more information about building a speech recognition grammar using strings, see Using Strings to Create a GrammarBuilder Grammar.
For detailed information on the use of subset matching modes, see System.Speech.Recognition::SubsetMatchingMode.
The following example creates a speech recognition grammar for each SubsetMatchingMode value. For example, the generated grammar OrderedSubset recognizes the phrases, "three four five" and "one three five", and the grammar Subsequence recognizes the phrase "three four five", but not the phrase, "one three five".
private Grammar[] CreateSubsetMatchTest() { List<Grammar> grammars = new List<Grammar>(4); string phrase = "one two three four five six"; foreach (SubsetMatchingMode mode in Enum.GetValues(typeof(SubsetMatchingMode))) { GrammarBuilder gb = new GrammarBuilder(); gb.Append(phrase, mode); Grammar grammar = new Grammar(gb); grammar.Name = mode.ToString(); grammars.Add(grammar); } return grammars.ToArray(); }
Available since 3.0