Export (0) Print
Expand All

SrgsRule Class

Represents a grammar rule.

System.Object
  System.Speech.Recognition.SrgsGrammar.SrgsRule

Namespace:  System.Speech.Recognition.SrgsGrammar
Assembly:  System.Speech (in System.Speech.dll)

[SerializableAttribute]
public class SrgsRule

The SrgsRule type exposes the following members.

  NameDescription
Public methodSrgsRule(String)Initializes a new instance of the SrgsRule class and specifies the identifier for the rule.
Public methodSrgsRule(String, SrgsElement[])Initializes a new instance of the SrgsRule class from an array of SrgsElement objects.
Top

  NameDescription
Public propertyBaseClassThis property is not currently supported.
Public propertyElementsGets the collection of SrgsElement objects in the SrgsRule instance.
Public propertyIdGets or sets the identifier for the rule.
Public propertyOnErrorThis property is not currently supported.
Public propertyOnInitThis property is not currently supported.
Public propertyOnParseThis property is not currently supported.
Public propertyOnRecognitionThis property is not currently supported.
Public propertyScopeGets or sets whether a rule can be activated for recognition and when the rule can be referenced by other rules.
Public propertyScriptThis property is not currently supported.
Top

  NameDescription
Public methodAddAdds an SrgsElement to an SrgsRule object.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

Use the SrgsRule class to create a new rule at run time or to modify a rule in an existing grammar stream or file at run time.

The words and phrases specified by SrgsRule objects in grammars defined by SrgsDocument instances limit the spoken input that the recognizer must be able to identify.

An SrgsRule object specifies the sequence in which words and phrases must be spoken by ordering the objects that contain them. Words and phrases within a rule are represented by objects such as SrgsItem, SrgsOneOf, SrgsRuleRef, and SrgsToken elements. Use the Elements property to access the collection of child objects that an SrgsRule object contains.

You can determine whether an SrgsRule can be specified in a rule reference from a rule in an external grammar by setting its Scope property.

It is not legal to define an SrgsRule that is empty or that contains only white space.

This class represents the rule element that is defined in the World Wide Web Consortium (W3C) Speech Recognition Grammar Specification (SRGS) Version 1.0. For information about the SRGS rule element and details about its support by System.Speech, see rule Element.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft