SrgsItem Class

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

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

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

[SerializableAttribute]
public class SrgsItem : SrgsElement

NameDescription
System_CAPS_pubmethodSrgsItem()

Initializes a new instance of the SrgsItem class.

System_CAPS_pubmethodSrgsItem(Int32)

Initializes a new instance of the SrgsItem class and specifies the number of times that its contents must be spoken.

System_CAPS_pubmethodSrgsItem(Int32, Int32)

Initializes a new instance of the SrgsItem class and specifies minimum and maximum repetition counts.

System_CAPS_pubmethodSrgsItem(Int32, Int32, SrgsElement[])

Initializes a new instance of the SrgsItem class, specifies an array of SrgsElement objects to add to this instance, and sets minimum and maximum repetition counts.

System_CAPS_pubmethodSrgsItem(Int32, Int32, String)

Initializes a new instance of the SrgsItem class, specifies the text associated with the item, and specifies minimum and maximum repetition counts.

System_CAPS_pubmethodSrgsItem(SrgsElement[])

Initializes a new instance of the SrgsItem class and specifies an array of SrgsElement objects to add to this instance.

System_CAPS_pubmethodSrgsItem(String)

Initializes a new instance of the SrgsItem class and specifies its textual contents.

NameDescription
System_CAPS_pubpropertyElements

Gets the collection of objects contained by the SrgsItem instance.

System_CAPS_pubpropertyMaxRepeat

Gets the maximum number of times that a user can speak the contents of the SrgsItem.

System_CAPS_pubpropertyMinRepeat

Gets the minimum number of times that a user must speak the contents of the SrgsItem.

System_CAPS_pubpropertyRepeatProbability

Gets or sets the probability that a user will repeat the contents of this SrgsItem instance.

System_CAPS_pubpropertyWeight

Gets or sets a multiplying factor that adjusts the likelihood that an SrgsItem in a SrgsOneOf object will be spoken.

NameDescription
System_CAPS_pubmethodAdd(SrgsElement)

Adds an object to the collection of objects contained in this SrgsItem instance.

System_CAPS_pubmethodCreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodInitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodSetRepeat(Int32)

Sets the number of times that the contents of an SrgsItem must be spoken.

System_CAPS_pubmethodSetRepeat(Int32, Int32)

Sets the minimum number of times and the maximum number of times that an item can be spoken.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

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 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 System.Speech, see item Element.

.NET Framework
Available since 3.0

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

Return to top
Show: