Share via


Grammar Constructor

Creates instances of SpeechRecognizer objects.

Remarks

Grammar objects can be constructed from

Constructors may provide specification of a particular rule to be loaded as the grammar's entry point or root to support SRGS and CFG formats allowing the inclusion of multiple grammar rules, (see Grammar, Grammar(String,String), Grammar, Grammar(Stream,String,Uri), Grammar(SrgsDocument,String), Grammar(Stream,String), Grammar, Grammar, Grammar, Grammar(SrgsDocument,String,Uri)).

Specification of parameters during construction is also provided to support for the inclusion of scripts in a loaded grammars (see
Grammar, Grammar, Grammar, Grammar, Grammar).

A base URI can be passed to certain constructors to support references to other grammar objects with relative URIs, (see Grammar, Grammar, Grammar(Stream,String,Uri), Grammar

Note

Windows and the Speech platform provide security for applications loading a Grammar from a DLL or working with a Grammar supporting scripting. Scripts in Grammar objects are always run as if downloaded from a web page in the InternetZone, and the Common Language Runtime (CLR) isolates any DLL loaded to obtain a Grammar. In either case, the system may prevent permanent modification to the state of a Windows system. However, it remains a best practice to always verify the safety of any URI or DLL used to load a Grammar.

Overload List

Name Description
Grammar (GrammarBuilder)
Constructs a Grammar object from a valid GrammarBuilder instance
Grammar (SrgsDocument)
Constructs a new instance of Grammar from an instance of SrgsDocument.
Grammar (Stream)  
Grammar (String)
Constructs a new instance of Grammar from file containing a grammar specification.
Grammar (SrgsDocument, String)
Constructs a new instance of Grammar from an instance of SrgsDocument the name of a particular rule to be the grammar’s root rule may also be specified.
Grammar (Stream, String)
Constructs a new instance of Grammar from an instance System.IO.Stream connecting to an object containing a grammar specification; the name of a particular rule to be the grammar’s root rule may also be specified.
Grammar (String, String)
Constructs a new instance of Grammar from file containing a grammar specification; the name of a particular rule to be the grammar’s root rule may also be specified.
Grammar (SrgsDocument, String, Uri)
Constructs a new instance of Grammar from an instance of SrgsDocument the name of a particular rule to be the grammar’s root rule, and a base URI for relative references.
Grammar (Stream, String, Uri)
Constructs a new instance of Grammar from an instance System.IO.Stream connecting to an object containing a grammar specification; a base URI for relative references, may also be specified.

See Also

Reference

Grammar Class
Grammar Members
Microsoft.Speech.Recognition Namespace
GrammarBuilder
SpeechRecognizer
SpeechRecognitionEngine
Grammar Constructor

Other Resources

Speech Recognition Grammar Specification