SpeechRecognitionListConstraint SpeechRecognitionListConstraint SpeechRecognitionListConstraint SpeechRecognitionListConstraint Class

Definition

A constraint for a SpeechRecognizer object based on a list of words or phrases. When initialized, this object is added to the Constraints collection.

public : sealed class SpeechRecognitionListConstraint : ISpeechRecognitionConstraint, ISpeechRecognitionListConstraintpublic sealed class SpeechRecognitionListConstraint : ISpeechRecognitionConstraint, ISpeechRecognitionListConstraintPublic NotInheritable Class SpeechRecognitionListConstraint Implements ISpeechRecognitionConstraint, ISpeechRecognitionListConstraint// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Constraints, or grammars, define the spoken words and phrases that can be matched by the speech recognizer. You can specify one of the pre-defined, web-service grammars (SpeechRecognitionTopicConstraint ) or you can create a custom grammar, described here, that is installed with your app (speech recognition using a custom constraint is performed on the device).

  • Programmatic list constraints (SpeechRecognitionListConstraint ) provide a lightweight approach to creating simple grammars using a list of words or phrases. A list constraint works well for recognizing short, distinct phrases. Explicitly specifying all words in a grammar also improves recognition accuracy, as the speech recognition engine must only process speech to confirm a match. The list can also be programmatically updated.
  • A Speech Recognition Grammar Specification (SRGS) grammar (SpeechRecognitionGrammarFileConstraint ) is a static document that, unlike a programmatic list constraint, uses the XML format defined by the Version 1.0. An Speech Recognition Grammar Specification (SRGS) grammar provides the greatest control over the speech recognition experience by letting you capture multiple semantic meanings in a single recognition.

CompileConstraintsAsync must always be called before RecognizeAsync or RecognizeWithUIAsync, even if no constraints are specified in the Constraints property.

Constructors

SpeechRecognitionListConstraint(IIterable) SpeechRecognitionListConstraint(IIterable) SpeechRecognitionListConstraint(IIterable) SpeechRecognitionListConstraint(IIterable)

Creates an instance of the SpeechRecognitionListConstraint class from an array of words or phrases.

public : SpeechRecognitionListConstraint(IIterable<PlatForm::String> commands)public SpeechRecognitionListConstraint(IEnumerable<String> commands)Public Sub New(commands As IEnumerable<String>)// You can use this method in JavaScript.
Parameters
commands
IIterable<PlatForm::String> IEnumerable<String> IEnumerable<String> IEnumerable<String>

A string array of words or phrases that make up the constraint.

See Also

SpeechRecognitionListConstraint(IIterable, String) SpeechRecognitionListConstraint(IIterable, String) SpeechRecognitionListConstraint(IIterable, String) SpeechRecognitionListConstraint(IIterable, String)

Creates an instance of the SpeechRecognitionListConstraint class from an array of words or phrases and a tag.

public : SpeechRecognitionListConstraint(IIterable<PlatForm::String> commands, PlatForm::String tag)public SpeechRecognitionListConstraint(IEnumerable<String> commands, String tag)Public Sub New(commands As IEnumerable<String>, tag As String)// You can use this method in JavaScript.
Parameters
commands
IIterable<PlatForm::String> IEnumerable<String> IEnumerable<String> IEnumerable<String>

A string array of words or phrases that make up the constraint.

tag
PlatForm::String String String String

The tag to assign to the constraint.

See Also

Properties

Commands Commands Commands Commands

Gets the array of words or phrases that make up the constraint.

public : IVector<string> Commands { get; }public IList<string> Commands { get; }Public ReadOnly Property Commands As IList<string>// You can use this property in JavaScript.
Value
IVector<PlatForm::String> IList<string> IList<string> IList<string>

A string array of words or phrases that make up the constraint.

Remarks

Modifications to the constraint collection are ignored. You must create a new SpeechRecognitionListConstraint.

See Also

IsEnabled IsEnabled IsEnabled IsEnabled

Gets or sets whether the constraint can be used by the speech recognizer to perform recognition.

public : PlatForm::Boolean IsEnabled { get; set; }public bool IsEnabled { get; set; }Public ReadWrite Property IsEnabled As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

if a speech recognizer can perform recognition using the constraint; otherwise .

See Also

Probability Probability Probability Probability

Gets or sets the weighted value of the constraint.

public : SpeechRecognitionConstraintProbability Probability { get; set; }public SpeechRecognitionConstraintProbability Probability { get; set; }Public ReadWrite Property Probability As SpeechRecognitionConstraintProbability// You can use this property in JavaScript.
See Also

Tag Tag Tag Tag

Gets or sets a tag that can be useful for identifying the constraint.

public : PlatForm::String Tag { get; set; }public string Tag { get; set; }Public ReadWrite Property Tag As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

A string representing the tag.

See Also

Type Type Type Type

Gets the type of the constraint.

public : SpeechRecognitionConstraintType Type { get; }public SpeechRecognitionConstraintType Type { get; }Public ReadOnly Property Type As SpeechRecognitionConstraintType// You can use this property in JavaScript.
See Also

See Also