Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

SubsetMatchingMode Enumeration

Enumerates values of subset matching mode.

Namespace:  System.Speech.Recognition
Assembly:  System.Speech (in System.Speech.dll)
public enum SubsetMatchingMode
Member nameDescription
SubsequenceIndicates that subset matching mode is Subsequence.
OrderedSubsetIndicates that subset matching mode is OrderedSubset.
SubsequenceContentRequiredIndicates that subset matching mode is SubsequenceContentRequired.
OrderedSubsetContentRequiredIndicates that subset matching mode is OrderedSubsetContentRequired.

In System.Speech, 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) or SrgsSubset() constructors, 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.

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 ( System.Speech.Recognition.SubsetMatchingMode mode 
              in Enum.GetValues(typeof(System.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);
  }
}

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.