SubsetMatchingMode Enumeration

Enumerates values of subset matching mode.

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

Syntax

'Declaration
Public Enumeration SubsetMatchingMode
public enum SubsetMatchingMode
public enum class SubsetMatchingMode
public enum SubsetMatchingMode
public enum SubsetMatchingMode

Members

Member name Description
OrderedSubset Indicates that subset matching mode is OrderedSubset.
OrderedSubsetContentRequired Indicates that subset matching mode is OrderedSubsetContentRequired.
Subsequence Indicates that subset matching mode is Subsequence.
SubsequenceContentRequired Indicates that subset matching mode is SubsequenceContentRequired.

Remarks

Under the Speech platform a grammar can be constructed so that recognition takes place, 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 rules for recognition engine matching against subsets of phrases are defined by the SubsetMatchingMode members that are used as arguments to GrammarBuilder, and to SrgsSubset methods used in constructing a Grammar.

Note

A recognition engine can optimize its matching algorithm by ignoring prepositions and articles in the audio input and the grammar elements.

For example, consider the cases of a grammar created when the phrase "a car the truck a boat that plane" is added to a Grammar flagged by each of the SubsetMatchingMode members.

OrderedSubset

OrderedSubset indicates that recognition of a subset string should take place if:

  • One or more words in the match string are recognized in the audio input.

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

  • A matched word may be a preposition or article.

When the phrase "a car the truck a boat that plane" is added to the grammar with OrderedSubset, then:

Input Phrase Containing:

Result:

"a car the truck a boat that plane"

Will be identified.

"a car the truck a boat"

Will be identified.

"a car the that plane"

Will be identified. A recognized subset is not required to be a sequence of the original string.

"a car the boat a truck that plane"

Will not be identified. The words are out of order.

"a the"

Will be identified. Prepositions and articles are recognized.

OrderedSubsetContentRequired:

Indicates that recognition of a subset string should take place if:

  • One or more words in the match string are recognized in the audio input, and

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

  • A matched word may not be a preposition or article.

When the phrase "a car the truck a boat that plane" is added to the grammar with OrderedSubsetContentRequired, then:

Input Phrase Containing:

Result:

"a car the truck a boat that plane"

Will be identified.

"a car the truck a boat"

Will be identified.

"a car the that plane"

Will be identified. A recognized subset is not required to be a sequence of the original string.

"a car the boat a truck that plane"

Will not be identified. The words are out of order.

"a the"

Will not be identified. Prepositions and articles are recognized.

Subsequence:

Indicates that recognition of a subset string should take place if:

  • One or more words in the match string are recognized in the audio input as a sequence in the audio input, and

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

  • A matched word may be a preposition or article.

When the phrase "a car the truck a boat that plane" is added to the grammar with Subsequence, then:

Input Phrase Containing:

Result:

"a car the truck a boat that plane"

Will be identified.

"a car the truck a boat"

Will be identified.

"a car the that plane"

Will not be identified. A recognized subset is required to be a sequence of the original string.

"a car the boat a truck that plane"

Will not be identified. The words are out of order.

"a the"

Will be identified. Prepositions and articles are recognized.

SubsequenceContentRequired:

Indicates that recognition of a subset string should take place if:

  • One or more words in the match string are recognized in the audio input as a sequence in the audio input.

  • A matched word may not be a preposition or article.

When the phrase "a car the truck a boat that plane" is added to the grammar with SubsequenceContentRequired, then:

Input Phrase Containing:

Result:

"a car the truck a boat that plane"

Will be identified.

"a car the truck a boat"

Will be identified.

"a car the that plane"

Will not be identified. A recognized subset is required to be a sequence of the original string.

"a car the boat a truck that plane"

Will not be identified. The words are out of order.

"a the"

Will not be identified. Prepositions and articles are not recognized.

Example

Below is a test routine which generates four Grammar, one for each mode with the same string. These Grammar 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);
    }

}

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition

Target Platforms

See Also

Reference

Microsoft.Speech.Recognition Namespace
GrammarBuilder Class
SrgsSubset
Microsoft.Speech.Recognition.SrgsGrammar