Note

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

sapi:subset Element (Microsoft.Speech)

Specifies a phrase and a matching mode that allows the entire phrase to be recognized when only a subset of that phrase is found in the speech input.

Syntax

<sapi:subset 
  sapi:match="matchingMode"> 
</sapi:subset>

Attributes

Attribute

Description

sapi:match

Takes one of the following four values that define the subset of the phrase that can be used to recognize the entire phrase :

  • ordered-subset. The entire phrase will be recognized if one or more words in the speech input occur in the same order as in the phrase, and the relative order of the recognized words is the same as in the phrase. Speech input may consist of only prepositions and articles.

  • ordered-subset-content-required. Same as ordered-subset, except speech input cannot consist of only prepositions and articles.

  • subsequence. The entire phrase will be recognized if one or more words in the speech input occur in the exact same sequence as in the phrase. Speech input may consist of only prepositions and articles.

  • subsequence-content-required. Same as subsequence, except speech input cannot consist of only prepositions and articles.

Important

When using the sapi:subset element, you must include the following declaration in the grammar Element (Microsoft.Speech): xmlns:sapi=https://schemas.microsoft.com/Speech/2002/06/SRGSExtensions.

Remarks

By default, a speech recognition engine requires an exact match against an entire phrase specified in a grammar. The recognition engine can also match partial phrases using matching modes that are defined by values of the sapi:match attribute of a sapi:subset element.

The following table illustrates how each of the values for the sapi:match attribute affects recognition when speech input contains only a subset of the entire phrase contained in the sapi:subset element.

Recognition Results for Subsets

Example

The following is an SRGS XML grammar that demonstrates an example use of the sapi:subset element.

<grammar version="1.0" xml:lang="en-US" root="locomotion"
 xmlns="http://www.w3.org/2001/06/grammar"
xmlns:sapi="https://schemas.microsoft.com/Speech/2002/06/SRGSExtensions">

  <rule id="locomotion">
    <sapi:subset sapi:match="subsequence"> a car the truck a boat that plane </sapi:subset>
  </rule>

</grammar>