Enumerates values of subset matching mode.
Namespace:
Microsoft.Speech.Recognition
Assembly:
Microsoft.Speech (in Microsoft.Speech.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Enumeration SubsetMatchingMode |
Visual Basic (Usage) |
---|
Dim instance As SubsetMatchingMode |
C# |
---|
public enum SubsetMatchingMode |
Members
Member name | Description | |
---|---|---|
Subsequence | Indicates that subset matching mode is Subsequence. | |
OrderedSubset | Indicates that subset matching mode is OrderedSubset. | |
SubsequenceContentRequired | Indicates that subset matching mode is SubsequenceContentRequired. | |
OrderedSubsetContentRequired | Indicates that subset matching mode is OrderedSubsetContentRequired. |
Remarks
Using the Microsoft Speech Platform SDK 11, you can construct a grammar that successfully recognizes a phrase even though only a subset of its contents is found in the audio input.
By default, a recognition engine requires an exact match against an entire phrase. The recognition engine can also match partial phrases according to parameters defined by a SubsetMatchingMode member used as an argument to the GrammarBuilder(String, SubsetMatchingMode) constructor or the Append method.
The following illustrates how each of the SubsetMatchingMode members affects recognition when used in a grammar that contains the phrase "a car the truck a boat that plane".
OrderedSubset
This mode indicates that a subset of the phrase will be used to successfully recognize the entire phrase if the following are true:
One or more words in the phrase are recognized in the audio input.
The relative order of those recognized words is the same as in the phrase.
Matched words may consist of only prepositions and articles.
Adding the phrase "a car the truck a boat that plane" to a grammar using OrderedSubset mode produces the following result on recognition:
Input Phrase | Result |
---|---|
"a car the truck a boat that plane" | The entire phrase "a car the truck a boat that plane" is recognized. |
"a car the truck a boat" | The entire phrase "a car the truck a boat that plane" is recognized. |
"a car the that plane" | The entire phrase "a car the truck a boat that plane" is recognized. A recognized subset is not required to be a sequence of the original string. |
"a car the boat a truck that plane" | Recognition is not successful. The words are out of order. |
"a the" | The entire phrase "a car the truck a boat that plane" is recognized. Prepositions and articles are used for recognition. |
OrderedSubsetContentRequired
This mode indicates that a subset of the phrase will be used to successfully recognize the entire phrase if the following are true:
One or more words in the phrase are recognized in the audio input, and
The relative order of those recognized words is the same as in the phrase.
Matched words cannot consist of only prepositions and articles.
Adding the phrase "a car the truck a boat that plane" to a grammar using OrderedSubsetContentRequired mode produces the following result on recognition:
Input Phrase | Result |
---|---|
"a car the truck a boat that plane" | The entire phrase "a car the truck a boat that plane" is recognized. |
"a car the truck a boat" | The entire phrase "a car the truck a boat that plane" is recognized. |
"a car the that plane" | The entire phrase "a car the truck a boat that plane" is recognized. A recognized subset is not required to be a sequence of the original string. |
"a car the boat a truck that plane" | Recognition is not successful. The words are out of order. |
"a the" | Recognition is not successful. Speech input must contain words other than articles and prepositions. |
Subsequence:
This mode indicates that a subset of the phrase will be used to successfully recognize the entire phrase if the following are true:
One or more words in the phrase are recognized in the audio input as a sequence of the phrase, and
The relative order of those recognized words is the same as in the phrase.
Matched words may consist of only prepositions and articles.
Adding the phrase "a car the truck a boat that plane" to a grammar using Subsequence mode produces the following result on recognition:
Input Phrase | Result |
---|---|
"a car the truck a boat that plane" | The entire phrase "a car the truck a boat that plane" is recognized. |
"a car the truck a boat" | The entire phrase "a car the truck a boat that plane" is recognized. |
"a car the that plane" | Recognition is not successful. A recognized subset is required to be a sequence of the original string. |
"a car the boat a truck that plane" | Recognition is not successful. The words are out of order. |
"a the" | The entire phrase "a car the truck a boat that plane" is recognized. Prepositions and articles are used for recognition. |
SubsequenceContentRequired
This mode indicates that a subset of the phrase will be used to successfully recognize the entire phrase if the following are true:
One or more words in the match string are recognized in the audio input as a sequence of the phrase.
Matched words cannot consist of only prepositions and articles.
Adding the phrase "a car the truck a boat that plane" to a grammar using SubsequenceContentRequired mode produces the following result on recognition:
Input Phrase | Result |
---|---|
"a car the truck a boat that plane" | The entire phrase "a car the truck a boat that plane" is recognized. |
"a car the truck a boat" | The entire phrase "a car the truck a boat that plane" is recognized. |
"a car the that plane" | Recognition is not successful. A recognized subset is required to be a sequence of the original string. |
"a car the boat a truck that plane" | Recognition is not successful. The words are out of order. |
"a the" | Recognition is not successful. Speech input must contain words other than articles and prepositions. |
Examples
Below is a test routine which generates four Grammar objects, using the same phrase, for each of the SubsetMatchingModes. These Grammar objects can then be tested.
Copy Code | |
---|---|
private void CreateSubsetMatchTest() { foreach ( Microsoft.Speech.Recognition.SubsetMatchingMode mode in Enum.GetValues(typeof(Microsoft.Speech.Recognition.SubsetMatchingMode))) { GrammarBuilder gb = new GrammarBuilder("a car the truck a boat that plane",mode); Grammar grammar = new Grammar(gb); grammar.Name = mode.ToString(); grammar.Enabled=true; _recognizer.LoadGrammar(grammar); } } |