Partager via


Note

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

GrammarBuilder Constructor

Include Protected Members
Include Inherited Members

Constructs a new instance of GrammarBuilder.

Overload List

  Name Description
Public method GrammarBuilder() Initializes a new, empty instance of the GrammarBuilder class.
Public method GrammarBuilder(String) Initializes a new instance of the GrammarBuilder class from a sequence of words.
Public method GrammarBuilder(Choices) Initializes a new instance of the GrammarBuilder class from a set of alternatives.
Public method GrammarBuilder(SemanticResultKey) Initializes a new instance of the GrammarBuilder class from a semantic key.
Public method GrammarBuilder(SemanticResultValue) Initializes a new instance of the GrammarBuilder class from a semantic value.
Public method GrammarBuilder(String, SubsetMatchingMode) Initializes a new instance of the GrammarBuilder class from a subset of a sequence of words.
Public method GrammarBuilder(String, Int32, Int32) Initializes a new instance of the GrammarBuilder class from the sequence of words in a String and specifies how many times the String can be repeated.
Public method GrammarBuilder(GrammarBuilder, Int32, Int32) Initializes a new instance of the GrammarBuilder class for a repeated element.

Top

Remarks

Instances of this class can also be obtained by implicit conversions from other classes or by combining a GrammarBuilder object with a second object to from a new GrammarBuilder. For more information, see the Implicit and Addition methods.

To add constraints to an existing GrammarBuilder, use the Add, Append, AppendDictation, AppendRuleReference, and AppendWildcard methods, and the Addition operator.

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