System.Speech.Recognition.SrgsGrammar Namespace

 

With the members of the System.Speech.Recognition.SrgsGrammar namespace, you can programmatically create grammars that comply with the W3C Speech Recognition Grammar Specification Version 1.0 (SRGS).

ClassDescription
System_CAPS_pubclassSrgsDocument

Defines a design-time object that is used to build strongly-typed runtime grammars that conform to the Speech Recognition Grammar Specification (SRGS) Version 1.0.

System_CAPS_pubclassSrgsElement

Defines the base class for classes in the System.Speech.Recognition.SrgsGrammar namespace that correspond to the elements in an SRGS grammar.

System_CAPS_pubclassSrgsGrammarCompiler

Compiles SrgsDocument and XML-format grammar files into binary grammar files with the .cfg extension and sends the output to a stream.

System_CAPS_pubclassSrgsItem

Represents a grammar element that contains phrases or other entities that a user can speak to produce a successful recognition.

System_CAPS_pubclassSrgsNameValueTag

Represents an element for associating a semantic value with a phrase in a grammar.

System_CAPS_pubclassSrgsOneOf

Represents a list of alternative words or phrases, any one of which may be used to match speech input.

System_CAPS_pubclassSrgsRule

Represents a grammar rule.

System_CAPS_pubclassSrgsRuleRef

Represents the grammar element that specifies a reference to a rule.

System_CAPS_pubclassSrgsRulesCollection

Represents a collection of SrgsRule objects.

System_CAPS_pubclassSrgsSemanticInterpretationTag

Represents a tag that contains ECMAScript that is run when the rule is matched.

System_CAPS_pubclassSrgsSubset

Defines methods and properties that can be used to match a given string with a spoken phrase.

System_CAPS_pubclassSrgsText

Represents the textual content of grammar elements defined by the World Wide Web Consortium (W3C) Speech Recognition Grammar Specification (SRGS) Version 1.0.

System_CAPS_pubclassSrgsToken

Represents a word or short phrase that can be recognized.

EnumerationDescription
System_CAPS_pubenumSrgsGrammarMode

Indicates the type of input that the grammar, defined by the SrgsDocument, will match.

System_CAPS_pubenumSrgsPhoneticAlphabet

Enumerates the supported phonetic alphabets.

System_CAPS_pubenumSrgsRuleScope

Enumerates values for the scope of a SrgsRule object.

To create an SRGS grammar programmatically, you construct an empty SrgsDocument instance and add instances of classes that represent SRGS elements. The SrgsItem, SrgsOneOf, SrgsRule, SrgsRuleRef, SrgsSemanticInterpretationTag, and SrgsToken classes represent elements defined in the SRGS specification. Some of the properties of the SrgsDocument class represent attributes in the SRGS specification, such as Root, Mode, Culture, and XmlBase. See SRGS Grammar XML for a reference to the elements and attributes of the SRGS specification as supported by System.Speech.

To add a grammar rule to a SrgsDocument, use the Add method of the SrgsRule class. You can modify the text within an SRGS element using the Text property of a SrgsText instance.

With the SrgsSubset class, you can optimize recognition of phrases in a grammar by specifying subsets of a complete phrase that will be allowed to constitute a match, and by selecting a matching mode from the SubsetMatchingMode enumeration.

See Create Grammars Using SrgsGrammar in the System Speech Programming Guide for .NET Framework 4.0 for more information and examples.

You can also construct SrgsDocument instances from existing SRGS-compliant XML grammar files, from an instance of SrgsRule, or from an instance of GrammarBuilder.

You can use the methods of the SrgsGrammarCompiler class to prepare completed SrgsDocument objects for consumption by a speech recognition engine.

Grammars created with members of the System.Speech.Recognition.SrgsGrammar namespace can be used by constructors of the Grammar class to create Grammar objects.

Return to top
Show: