ISpeechPhraseAlternate Interface (SAPI 5.4)

Speech API 5.4
Microsoft Speech API 5.4


The ISpeechPhraseAlternate automation interface enables applications to retrieve alternate phrase information from a speech recognition (SR) engine, and to update the SR engine's language model to reflect committed alternate changes.

There are two types of speech recognition in SAPI: Command and control (C&C) recognition, which is guided by one or more grammars; and dictation recognition, in which the SR engine uses statistical calculations to determine the most likely recognitions of a requested phrase. It should be noted that the two types are not mutually exclusive, and that applications do not request one type of recognition as opposed to the other. Applications simply request recognition; they can determine after the fact which type of recognition produced a particular recognition result.

Dictation recognition is inherently less accurate than C&C recognition, which is guided by grammars. Because of this, there is a practical need for returning alternate recognition results, and for the user to select an alternate as the correct recognition of the phrase.

The ISpeechRecoResult.Alternates method returns a specific number of recognitions in an ISpeechPhraseAlternates object. It should be noted that the default recognition result is the first ISpeechPhraseAlternate object in the collection.

Use of the ISpeechPhraseAlternate object is demonstrated in a code example at the end of this section.

Automation Interface Elements

The ISpeechPhraseAlternate automation interface contains the following elements:

NumberOfElementsInResult PropertyReturns the count of phrase elements in the alternate's parent ISpeechRecoResult object.
PhraseInfo PropertyReturns the ISpeechPhraseInfo object of the alternate's parent ISpeechRecoResult object.
RecoResult PropertyReturns the alternate's parent ISpeechRecoResult object.
StartElementInResult PropertySpecifies the starting phrase element of the alternate's parent ISpeechRecoResult object.
Commit MethodSpecifies that the alternate recognition should replace the recognition selected by the SR engine.