SpeechRecognitionGrammarFileConstraint
SpeechRecognitionGrammarFileConstraint
SpeechRecognitionGrammarFileConstraint
SpeechRecognitionGrammarFileConstraint
Class
Definition
A constraint for a SpeechRecognizer object based on a Speech Recognition Grammar Specification (SRGS) file.
public : sealed class SpeechRecognitionGrammarFileConstraint : ISpeechRecognitionConstraint, ISpeechRecognitionGrammarFileConstraintpublic sealed class SpeechRecognitionGrammarFileConstraint : ISpeechRecognitionConstraint, ISpeechRecognitionGrammarFileConstraintPublic NotInheritable Class SpeechRecognitionGrammarFileConstraint Implements ISpeechRecognitionConstraint, ISpeechRecognitionGrammarFileConstraint// You can use this class in JavaScript.
- Attributes
| 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.
- 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.
Constructors
SpeechRecognitionGrammarFileConstraint(StorageFile) SpeechRecognitionGrammarFileConstraint(StorageFile) SpeechRecognitionGrammarFileConstraint(StorageFile) SpeechRecognitionGrammarFileConstraint(StorageFile)
Creates an instance of the SpeechRecognitionGrammarFileConstraint class from a file object.
public : SpeechRecognitionGrammarFileConstraint(StorageFile file)public SpeechRecognitionGrammarFileConstraint(StorageFile file)Public Sub New(file As StorageFile)// You can use this method in JavaScript.
An object representing a Speech Recognition Grammar Specification (SRGS) grammar file.
SpeechRecognitionGrammarFileConstraint(StorageFile, String) SpeechRecognitionGrammarFileConstraint(StorageFile, String) SpeechRecognitionGrammarFileConstraint(StorageFile, String) SpeechRecognitionGrammarFileConstraint(StorageFile, String)
Creates an instance of the SpeechRecognitionGrammarFileConstraint class from a file object and a tag.
public : SpeechRecognitionGrammarFileConstraint(StorageFile file, PlatForm::String tag)public SpeechRecognitionGrammarFileConstraint(StorageFile file, String tag)Public Sub New(file As StorageFile, tag As String)// You can use this method in JavaScript.
An object representing a Speech Recognition Grammar Specification (SRGS) grammar file.
- tag
- PlatForm::String String String String
The tag to assign to the constraint.
- See Also
Properties
GrammarFile GrammarFile GrammarFile GrammarFile
Gets the StorageFile object representing the Speech Recognition Grammar Specification (SRGS) grammar file.
public : StorageFile GrammarFile { get; }public StorageFile GrammarFile { get; }Public ReadOnly Property GrammarFile As StorageFile// You can use this property in JavaScript.
The object representing the Speech Recognition Grammar Specification (SRGS) grammar file.
- 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
True if a speech recognizer can perform recognition using the constraint; otherwise false.
- 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.
- Value
- SpeechRecognitionConstraintProbability SpeechRecognitionConstraintProbability SpeechRecognitionConstraintProbability SpeechRecognitionConstraintProbability
An enumeration that indicates the weighted value of the constraint.
- 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.
- Value
- SpeechRecognitionConstraintType SpeechRecognitionConstraintType SpeechRecognitionConstraintType SpeechRecognitionConstraintType
An enumeration that indicates the type of the constraint. Always returns Grammar for SpeechRecognitionGrammarFileConstraint.
- See Also