Share via


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

GrammarBuilder.Add Method

Include Protected Members
Include Inherited Members

Creates a new GrammarBuilder that contains a sequence of two grammar elements.

Overload List

  Name Description
Public methodStatic member Add(String, GrammarBuilder) Creates a new GrammarBuilder that contains a phrase followed by a GrammarBuilder object.
Public methodStatic member Add(Choices, GrammarBuilder) Creates a new GrammarBuilder that contains a Choices object followed by a GrammarBuilder object.
Public methodStatic member Add(GrammarBuilder, Choices) Creates a new GrammarBuilder that contains a GrammarBuilder object followed by a Choices object.
Public methodStatic member Add(GrammarBuilder, GrammarBuilder) Creates a new GrammarBuilder that contains a sequence of two GrammarBuilder objects.
Public methodStatic member Add(GrammarBuilder, String) Creates a new GrammarBuilder that contains a GrammarBuilder object followed by a phrase.

Top

Remarks

The static Add methods provide another mechanism by which you can combine various types to create diversity and flexibility in grammars built with GrammarBuilder. These methods correspond to the static Addition methods, which are also defined on the GrammarBuilder class. The order of the parameters determines the order of the elements in the new GrammarBuilder.

A GrammarBuilder can also be obtained from Choices, SemanticResultKey, SemanticResultValue, and String objects. For more information, see the Implicit and Addition operators.

Important

The speech recognizer can throw an exception when using a speech recognition grammar that contains duplicate semantic elements with the same key name or multiple semantic elements that could repeatedly modify the value of the same semantic element. For more information about building a speech recognition grammar that contains semantic information, see Add Semantics to a GrammarBuilder Grammar (Microsoft.Speech).

For more information about building and using speech recognition grammars, see Speech Recognition (Microsoft.Speech) and Create Grammars Using GrammarBuilder (Microsoft.Speech).

See Also

Reference

GrammarBuilder Class

GrammarBuilder Members

Microsoft.Speech.Recognition Namespace