Export (0) Print
Expand All

SrgsItem Class

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)

[SerializableAttribute]
public class SrgsItem : SrgsElement

The SrgsItem type exposes the following members.

  NameDescription
Public methodSrgsItem()Initializes a new instance of the SrgsItem class.
Public methodSrgsItem(Int32)Initializes a new instance of the SrgsItem class and specifies the number of times that its contents must be spoken.
Public methodSrgsItem(SrgsElement[])Initializes a new instance of the SrgsItem class and specifies an array of SrgsElement objects to add to this instance.
Public methodSrgsItem(String)Initializes a new instance of the SrgsItem class and specifies its textual contents.
Public methodSrgsItem(Int32, Int32)Initializes a new instance of the SrgsItem class and specifies minimum and maximum repetition counts.
Public methodSrgsItem(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 methodSrgsItem(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

  NameDescription
Public propertyElementsGets the collection of objects contained by the SrgsItem instance.
Public propertyMaxRepeatGets the maximum number of times that a user can speak the contents of the SrgsItem.
Public propertyMinRepeatGets the minimum number of times that a user must speak the contents of the SrgsItem.
Public propertyRepeatProbabilityGets or sets the probability that a user will repeat the contents of this SrgsItem instance.
Public propertyWeightGets or sets a multiplying factor that adjusts the likelihood that an SrgsItem in a SrgsOneOf object will be spoken.
Top

  NameDescription
Public methodAddAdds an object to the collection of objects contained in this SrgsItem instance.
Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected methodMemberwiseClone()Creates a shallow copy of the current Object. (Inherited from Object.)
Protected methodMemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Public methodSetRepeat(Int32)Sets the number of times that the contents of an SrgsItem must be spoken.
Public methodSetRepeat(Int32, Int32)Sets the minimum number of times and the maximum number of times that an item can be spoken.
Public methodToStringReturns 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 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.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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.
Show:
© 2014 Microsoft