This topic has not yet been rated - Rate this topic

SrgsItem Class

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

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

Namespace:  System.Speech.Recognition.SrgsGrammar
Assembly:  System.Speech (in System.Speech.dll)
[SerializableAttribute]
public class SrgsItem : SrgsElement

The SrgsItem type exposes the following members.

  Name Description
Public method SrgsItem() Initializes a new instance of the SrgsItem class.
Public method SrgsItem(Int32) Initializes a new instance of the SrgsItem class and specifies the number of times that its contents must be spoken.
Public method SrgsItem(SrgsElement[]) Initializes a new instance of the SrgsItem class and specifies an array of SrgsElement objects to add to this instance.
Public method SrgsItem(String) Initializes a new instance of the SrgsItem class and specifies its textual contents.
Public method SrgsItem(Int32, Int32) Initializes a new instance of the SrgsItem class and specifies minimum and maximum repetition counts.
Public method SrgsItem(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.
Public method SrgsItem(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.
Top
  Name Description
Public property Elements Gets the collection of objects contained by the SrgsItem instance.
Public property MaxRepeat Gets the maximum number of times that a user can speak the contents of the SrgsItem.
Public property MinRepeat Gets the minimum number of times that a user must speak the contents of the SrgsItem.
Public property RepeatProbability Gets or sets the probability that a user will repeat the contents of this SrgsItem instance.
Public property Weight Gets or sets a multiplying factor that adjusts the likelihood that an SrgsItem in a SrgsOneOf object will be spoken.
Top
  Name Description
Public method Add Adds an object to the collection of objects contained in this SrgsItem instance.
Public method CreateObjRef Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetLifetimeService Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method InitializeLifetimeService Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected method MemberwiseClone() Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method MemberwiseClone(Boolean) Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Public method SetRepeat(Int32) Sets the number of times that the contents of an SrgsItem must be spoken.
Public method SetRepeat(Int32, Int32) Sets the minimum number of times and the maximum number of times that an item can be spoken.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Top

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

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ