Aracılığıyla paylaş


SpeechRecognitionTopicConstraint Class

Definition

A pre-defined grammar constraint (specifed by SpeechRecognitionScenario) provided through a web service.

public ref class SpeechRecognitionTopicConstraint sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.Media.SpeechRecognition.ISpeechRecognitionTopicConstraintFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class SpeechRecognitionTopicConstraint final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Media.SpeechRecognition.ISpeechRecognitionTopicConstraintFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class SpeechRecognitionTopicConstraint final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Media.SpeechRecognition.ISpeechRecognitionTopicConstraintFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class SpeechRecognitionTopicConstraint
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Media.SpeechRecognition.ISpeechRecognitionTopicConstraintFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class SpeechRecognitionTopicConstraint
function SpeechRecognitionTopicConstraint(scenario, topicHint, tag)
Public NotInheritable Class SpeechRecognitionTopicConstraint
Inheritance
Object Platform::Object IInspectable SpeechRecognitionTopicConstraint
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

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 or you can create your own custom grammar (see SpeechRecognitionGrammarFileConstraint, SpeechRecognitionListConstraint, and SpeechRecognitionVoiceCommandDefinitionConstraint) that is installed with your app.

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

To use web-service constraints, speech input and dictation support must be enabled in Settings by turning on the "Get to know me" option in Settings -> Privacy -> Speech, inking, and typing. For more detail on recognition constraints, see "Recognize speech input" in Speech recognition.

Note

Increase recognition accuracy during a lengthy dictation session by using a SpeechRecognitionListConstraint in conjunction with the SpeechRecognitionTopicConstraint. This lets you provide a set of domain-specific keywords that you think are likely to be used during dictation.

Constructors

SpeechRecognitionTopicConstraint(SpeechRecognitionScenario, String, String)

Creates an instance of the SpeechRecognitionTopicConstraint class by using a pre-defined scenario type, context, and an identifier.

SpeechRecognitionTopicConstraint(SpeechRecognitionScenario, String)

Creates an instance of the SpeechRecognitionTopicConstraint class by using a pre-defined scenario type and context.

Properties

IsEnabled

Gets or sets whether the constraint can be used by the SpeechRecognizer object to perform recognition.

Probability

Gets or sets the weighted value of the constraint.

Scenario

Gets the predefined scenario type for the constraint.

Tag

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

TopicHint

Gets the topic hint for the constraint.

Type

Gets the type of the constraint.

Applies to

See also