GrammarBuilder..::..Append Method (String, SubsetMatchingMode) |
GrammarBuilder Class Example See Also Send Feedback |
Appends an element for a subset of a phrase to the current sequence of grammar elements.
Namespace:
Microsoft.Speech.Recognition
Assembly:
Microsoft.Speech (in Microsoft.Speech.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Sub Append ( _ phrase As String, _ subsetMatchingCriteria As SubsetMatchingMode _ ) |
Visual Basic (Usage) |
---|
Dim instance As GrammarBuilder Dim phrase As String Dim subsetMatchingCriteria As SubsetMatchingMode instance.Append(phrase, subsetMatchingCriteria) |
C# |
---|
public void Append( string phrase, SubsetMatchingMode subsetMatchingCriteria ) |
Parameters
- phrase
- Type: System..::..String
The sequence of words to append.
- subsetMatchingCriteria
- Type: Microsoft.Speech.Recognition..::..SubsetMatchingMode
The matching mode the grammar uses to recognize the phrase.
Remarks
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 Use a String to Create a GrammarBuilder (Microsoft.Speech).
For detailed information on the use of subset matching modes, see Microsoft.Speech.Recognition..::..SubsetMatchingMode.
Examples
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".
C# | Copy Code |
---|---|
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(); } |