Compartir a través de


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

SubsetMatchingMode Enumeration

Enumerates values of subset matching mode.

Namespace:  Microsoft.Speech.Recognition
Assembly:  Microsoft.Speech (in Microsoft.Speech.dll)

Syntax

'Declaration
Public Enumeration SubsetMatchingMode
'Usage
Dim instance As SubsetMatchingMode
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 speech 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 grammar phrase are recognized in the speech input.

  • The relative order of those recognized words is the same as in the phrase.

  • Speech input 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:

Speech Input

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 contiguous 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 grammar phrase are recognized in the speech input.

  • The relative order of those recognized words is the same as in the grammar phrase.

  • Matched speech input 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:

Speech Input

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 contiguous 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 speech input occur in the exact same sequence as in the grammar phrase.

  • Matched speech input 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:

Speech Input

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 contiguous 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 speech input occur in the exact same sequence as in the grammar phrase.

  • Matched speech input 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:

Speech Input

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

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);
  }
}

See Also

Reference

Microsoft.Speech.Recognition Namespace

GrammarBuilder