Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

SrgsItem Class

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

Inheritance Hierarchy

System.Object
  System.MarshalByRefObject
    Microsoft.Speech.Recognition.SrgsGrammar.SrgsElement
      Microsoft.Speech.Recognition.SrgsGrammar.SrgsItem

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

Syntax

'Declaration
<SerializableAttribute> _
Public Class SrgsItem _
    Inherits SrgsElement
'Usage
Dim instance As SrgsItem
[SerializableAttribute]
public class SrgsItem : SrgsElement

Remarks

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

The order in which SrgsItem objects appear in a given SrgsRule object specifies the order in which a user must speak them. By default, the contents of an SrgsItem must be spoken exactly once. To specify that the contents of an SrgsItem must be spoken repeatedly, use the SrgsItem(Int32) constructor and set the repeatCount parameter. Similarly, to specify a range for the number of times that an SrgsItem can be spoken, create the SrgsItem with one of the constructors that set the MaxRepeat property and the MinRepeat property. If the SrgsItem already exists, you can use one of the SrgsItem.SetRepeat or the SetRepeat methods to specify repeats.

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

SrgsItem objects within an SrgsOneOf object comprise 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) Version 1.0. For information about the SRGS item element and details about its support by the Microsoft Speech Platform SDK 11, see item Element (Microsoft.Speech).

Thread Safety

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

See Also

Reference

SrgsItem Members

Microsoft.Speech.Recognition.SrgsGrammar Namespace

Other Resources

Create Grammars Using SrgsGrammar (Microsoft.Speech)