SpeechRecognitionListConstraint SpeechRecognitionListConstraint SpeechRecognitionListConstraint SpeechRecognitionListConstraint SpeechRecognitionListConstraint Class

Definition

A custom grammar constraint based on a list of words or phrases that can be recognized by the SpeechRecognizer object. When initialized, this object is added to the Constraints collection.

Note

Speech recognition using a custom constraint is performed on the device.

public : sealed class SpeechRecognitionListConstraint : ISpeechRecognitionConstraint, ISpeechRecognitionListConstraint
struct winrt::Windows::Media::SpeechRecognition::SpeechRecognitionListConstraint : ISpeechRecognitionConstraint, ISpeechRecognitionListConstraint
public sealed class SpeechRecognitionListConstraint : ISpeechRecognitionConstraint, ISpeechRecognitionListConstraint
Public NotInheritable Class SpeechRecognitionListConstraint Implements ISpeechRecognitionConstraint, ISpeechRecognitionListConstraint
var speechRecognitionListConstraint = new speechRecognitionListConstraint(commands);
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.

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

Note

You can use a SpeechRecognitionListConstraint in conjunction with a web service SpeechRecognitionTopicConstraint to increase accuracy during a dictation session by providing a set of domain-specific keywords that you think are likely to be used.

Constructors

SpeechRecognitionListConstraint(IIterable<String>) 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.

SpeechRecognitionListConstraint(IIterable<String>, String) SpeechRecognitionListConstraint(IIterable<String>, String) SpeechRecognitionListConstraint(IIterable<String>, String) SpeechRecognitionListConstraint(IIterable<String>, String) SpeechRecognitionListConstraint(IIterable<String>, String)

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

Properties

Commands Commands Commands Commands Commands

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

IsEnabled IsEnabled IsEnabled IsEnabled IsEnabled

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

Probability Probability Probability Probability Probability

Gets or sets the weighted value of the constraint.

Tag Tag Tag Tag Tag

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

Type Type Type Type Type

Gets the type of the constraint.

See Also