SrgsRule SrgsRule SrgsRule SrgsRule Class

定义

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

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

注解

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对象 (如SrgsRuleRefSrgsOneOf、和SrgsToken元素) 表示。Words and phrases within a rule are represented by objects such as SrgsItem, SrgsOneOf, SrgsRuleRef, and SrgsToken elements. 使用属性可访问SrgsRule对象包含的子对象的集合。 ElementsUse the Elements property to access the collection of child objects that an SrgsRule object contains.

可以通过SrgsRule Scope设置外部语法中规则的属性来确定是否可以在规则引用中指定。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.

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

此类表示rule万维网联合会 (W3C)语音识别语法规范 (SRGS) 版本 1.0中定义的元素。This 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(String) SrgsRule(String) SrgsRule(String)

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

SrgsRule(String, SrgsElement[]) SrgsRule(String, SrgsElement[]) SrgsRule(String, SrgsElement[]) SrgsRule(String, SrgsElement[])

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

属性

BaseClass BaseClass BaseClass BaseClass

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

Elements Elements Elements Elements

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

Id Id Id Id

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

OnError OnError OnError OnError

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

OnInit OnInit OnInit OnInit

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

OnParse OnParse OnParse OnParse

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

OnRecognition OnRecognition OnRecognition OnRecognition

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

Scope Scope Scope Scope

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

Script Script Script Script

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

方法

Add(SrgsElement) Add(SrgsElement) Add(SrgsElement) Add(SrgsElement)

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

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Object)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
ToString() ToString() ToString() ToString()

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

(Inherited from Object)

适用于

另请参阅