Grammar Constructor
Initializes a new instance of the Grammar class.
Assembly: System.Speech (in System.Speech.dll)
| Name | Description | |
|---|---|---|
![]() | Grammar() | Initializes a new instance of the Grammar class |
![]() | Grammar(GrammarBuilder^) | Initializes a new instance of the Grammar class from a GrammarBuilder object. |
![]() | Grammar(SrgsDocument^) | Initializes a new instance of a Grammar class from an SrgsDocument object. |
![]() | Grammar(SrgsDocument^, String^) | Initializes a new instance of a Grammar class from an SrgsDocument object and specifies a root rule. |
![]() | Grammar(SrgsDocument^, String^, array<Object^>^) | Initializes a new instance of the Grammar class from an instance of SrgsDocument, and specifies the name of a rule to be the entry point to the grammar. |
![]() | Grammar(SrgsDocument^, String^, Uri^) | Initializes a new instance of a Grammar class from an SrgsDocument object, specifies a root rule, and defines a base Uniform Resource Identifier (URI) to resolve relative rule references. |
![]() | Grammar(SrgsDocument^, String^, Uri^, array<Object^>^) | Initializes a new instance of the Grammar class from an instance of SrgsDocument, and specifies the name of a rule to be the entry point to the grammar and a base URI to resolve relative references. |
![]() | Grammar(Stream^) | |
![]() | Grammar(Stream^, String^) | |
![]() | Grammar(Stream^, String^, array<Object^>^) | |
![]() | Grammar(Stream^, String^, Uri^) | Initializes a new instance of the Grammar class from a stream, specifies a root rule, and defines a base Uniform Resource Identifier (URI) to resolve relative rule references. |
![]() | Grammar(Stream^, String^, Uri^, array<Object^>^) | |
![]() | Grammar(String^) | Initializes a new instance of the Grammar class from a file. |
![]() | Grammar(String^, String^) | Initializes a new instance of the Grammar class from a file and specifies a root rule. |
![]() | Grammar(String^, String^, array<Object^>^) | Initializes a new instance of the Grammar class from a file that contains a grammar definition, and specifies the name of a rule to be the entry point to the grammar.. |
You can use a Grammar constructor to create a Grammar instance from a GrammarBuilder or SrgsDocument object, or from a file or a Stream that contains a description of a grammar in a supported format. Supported formats include the following:
XML-format files that conform to the W3C Speech Recognition Grammar Specification (SRGS) Version 1.0
Grammars that have been compiled to a binary file with a .cfg file extension
Grammar constructors that accept XML-format grammar files in their arguments compile the XML grammars to a binary format to optimize them for loading and consumption by a speech recognition engine. You can reduce the amount of time required to construct a Grammar object from an XML-format grammar by compiling the grammar in advance, using one of the Compile methods.
A speech recognition grammar can define a root rule. To create a Grammar object that specifies which rule to use as its root rule, use a constructor that accepts the ruleName parameter.
To create a Grammar object that specifies a base URI to resolve relative rule references, use a constructor that takes the baseUri parameter.

