Dela via


SrgsItem Class

Definition

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

public ref class SrgsItem : System::Speech::Recognition::SrgsGrammar::SrgsElement
public class SrgsItem : System.Speech.Recognition.SrgsGrammar.SrgsElement
[System.Serializable]
public class SrgsItem : System.Speech.Recognition.SrgsGrammar.SrgsElement
type SrgsItem = class
    inherit SrgsElement
[<System.Serializable>]
type SrgsItem = class
    inherit SrgsElement
Public Class SrgsItem
Inherits SrgsElement
Inheritance
Attributes

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 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.

Constructors

SrgsItem()

Initializes a new instance of the SrgsItem class.

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.

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.

SrgsItem(Int32, Int32)

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

SrgsItem(Int32)

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

SrgsItem(SrgsElement[])

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

SrgsItem(String)

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

Properties

Elements

Gets the collection of objects contained by the SrgsItem instance.

MaxRepeat

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

MinRepeat

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

RepeatProbability

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

Weight

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

Methods

Add(SrgsElement)

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

CreateObjRef(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)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLifetimeService()
Obsolete.

Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService()
Obsolete.

Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
SetRepeat(Int32, Int32)

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

SetRepeat(Int32)

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

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also