SrgsRule 类

定义

表示语法规则。Represents a grammar rule.

public ref class SrgsRule
[System.Serializable]
public class SrgsRule
[<System.Serializable>]
type SrgsRule = class
Public Class SrgsRule
继承
SrgsRule
属性

注解

使用 SrgsRule 类在运行时创建新规则,或在运行时修改现有语法流或文件中的规则。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.

由实例定义的语法中的对象指定的单词和短语 SrgsRule SrgsDocument 限制了识别器必须能够识别的朗读输入。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.

SrgsRule对象通过对包含关键字和短语的对象进行排序来指定字词和短语的序列。An SrgsRule object specifies the sequence in which words and phrases must be spoken by ordering the objects that contain them. 规则中的单词和短语由对象(如、、 SrgsItem SrgsOneOf SrgsRuleRef 和元素)表示 SrgsTokenWords and phrases within a rule are represented by objects such as SrgsItem, SrgsOneOf, SrgsRuleRef, and SrgsToken elements. 使用 Elements 属性可访问对象包含的子对象的集合 SrgsRuleUse the Elements property to access the collection of child objects that an SrgsRule object contains.

可以 SrgsRule 通过设置外部语法中规则的属性来确定是否可以在规则引用中指定 ScopeYou can determine whether an SrgsRule can be specified in a rule reference from a rule in an external grammar by setting its Scope property.

定义 SrgsRule 为空或仅包含空白的不是合法的。It is not legal to define an SrgsRule that is empty or that contains only white space.

此类表示 rule 万维网联合会 (W3C) 语音识别语法规范中定义的元素 (SRGS) 版本 1.0This class represents the rule element that is defined in the World Wide Web Consortium (W3C) Speech Recognition Grammar Specification (SRGS) Version 1.0. 有关 SRGS 元素的信息 rule 以及有关其对系统的支持的详细信息,请参阅 rule 元素For information about the SRGS rule element and details about its support by System.Speech, see rule Element.

构造函数

SrgsRule(String)

初始化 SrgsRule 类和指定规则的标识符的新实例。Initializes a new instance of the SrgsRule class and specifies the identifier for the rule.

SrgsRule(String, SrgsElement[])

SrgsElement 对象的数组初始化 SrgsRule 类的新实例。Initializes a new instance of the SrgsRule class from an array of SrgsElement objects.

属性

BaseClass

目前不支持此属性。This property is not currently supported.

Elements

获取 SrgsElement 实例中 SrgsRule 对象的集合。Gets the collection of SrgsElement objects in the SrgsRule instance.

Id

获取或设置规则的标识符。Gets or sets the identifier for the rule.

OnError

目前不支持此属性。This property is not currently supported.

OnInit

目前不支持此属性。This property is not currently supported.

OnParse

目前不支持此属性。This property is not currently supported.

OnRecognition

目前不支持此属性。This property is not currently supported.

Scope

获取或设置是否可以为识别激活一条规则,以及此规则何时可由其他规则引用。Gets or sets whether a rule can be activated for recognition and when the rule can be referenced by other rules.

Script

目前不支持此属性。This property is not currently supported.

方法

Add(SrgsElement)

SrgsElement 对象添加一个 SrgsRuleAdds an SrgsElement to an SrgsRule object.

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅