SpeechRecognitionGrammarFileConstraint Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A custom grammar constraint based on a list of words or phrases (defined in a Speech Recognition Grammar Specification (SRGS) file) that can be recognized by the SpeechRecognizer object.
Note
Speech recognition using a custom constraint is performed on the device.
public ref class SpeechRecognitionGrammarFileConstraint sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.Media.SpeechRecognition.ISpeechRecognitionGrammarFileConstraintFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class SpeechRecognitionGrammarFileConstraint 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.ISpeechRecognitionGrammarFileConstraintFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class SpeechRecognitionGrammarFileConstraint final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Media.SpeechRecognition.ISpeechRecognitionGrammarFileConstraintFactory), 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 SpeechRecognitionGrammarFileConstraint
[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.ISpeechRecognitionGrammarFileConstraintFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class SpeechRecognitionGrammarFileConstraint
function SpeechRecognitionGrammarFileConstraint(file, tag)
Public NotInheritable Class SpeechRecognitionGrammarFileConstraint
- Inheritance
- Attributes
- Implements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
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.
- An 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.
Speech |
Creates an instance of the SpeechRecognitionGrammarFileConstraint class from a file object and a tag. |
Speech |
Creates an instance of the SpeechRecognitionGrammarFileConstraint class from a file object. |
Grammar |
Gets the StorageFile object representing the Speech Recognition Grammar Specification (SRGS) grammar file. |
Is |
Gets or sets whether the constraint can be used by the speech recognizer to perform recognition. |
Probability |
Gets or sets the weighted value of the constraint. |
Tag |
Gets or sets a tag that can be useful for identifying the constraint. |
Type |
Gets the type of the constraint. |
Product | Versions |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |