This documentation is archived and is not being maintained.

SrgsItem Class

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

Namespace: Microsoft.Speech.Recognition.SrgsGrammar
Assembly: Microsoft.Speech (in microsoft.speech.dll)

[DebuggerDisplayAttribute("{DebuggerDisplayString ()}")] 
public class SrgsItem : SrgsElement
/** @attribute SerializableAttribute() */ 
/** @attribute DebuggerDisplayAttribute("{DebuggerDisplayString ()}") */ 
public class SrgsItem extends SrgsElement
DebuggerDisplayAttribute("{DebuggerDisplayString ()}") 
public class SrgsItem extends SrgsElement

An SrgsItem object can consist of phrases, entities such as SrgsRuleRef objects, logical combinations of phrases and SrgsRuleRef objects, and so on. The Elements property on the SrgsItem class can be used to gain access to the constituents of an SrgsItem object.

The order in which items appear in a given SrgsRule object specifies the order in which a user must speak them. By default, an individual item must be spoken exactly once. To specify that an item can be repeatedly spoken, create the item with one of the SrgsItem constructors that sets the MaxRepeat property. Similarly, to specify that an item must be spoken a minimum number of times, create the item with the constructor that sets the MaxRepeat property and the MinRepeat property. If the item already exists, you can use one of the SetRepeat methods.

You can also specify the probability that an item will be repeatedly spoken by setting the RepeatProbability property to an appropriate value.

Items within an SrgsOneOf object compose a list of alternatives from which the user can speak one. You can use the Weight property to specify the likelihood that a given item in the list will be spoken.

The SrgsItem class represents the item element that is defined in the World Wide Web Consortium (W3C) Speech Recognition Grammar Specification (SRGS).


All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition

Target Platforms