You are reading help file online using chmlib.com
|
Interface: ISpeechRecoResult
The Alternates method returns a list of alternate words.
Many recognitions, successful or not, frequently return several words or phrases that closely match the spoken sequence. The one most nearly matching the sequence with a high confidence level is returned as a successful recognition. The other words and phrases are returned as alternates that are available for examination.
ISpeechRecoResult.Alternates(
RequestCount As Long,
[StartElement As Long = 0],
[Elements As Long = -1]
) As ISpeechPhraseAlternates
The Alternates method returns an ISpeechPhraseAlternates variable.
ISpeechRecoResult.Alternates applies only to dictation grammar. Command and control alternates are handled separately and independently. See ISpeechRecoContext.CmdMaxAlternates for command and control alternates.
The following example returns the 30 most likely matches for a recognition. It assumes a successful recognition in RecoResult. The example also only uses one parameter, the number of alternates to return; the other parameters are assigned by default and return all the available words and phrases.
Dim phraseAlternate As ISpeechPhraseAlternates
Dim i As Long
Dim theString As String
Set phraseAlternate = RecoResult.Alternates(30)
For i = 0 To phraseAlternate.Count - 1
theString = phraseAlternate.Item(i).GetText
TextField.Text = TextField.Text + "Alternates #" + str(i) + ": " + theString + vbCrLf
Next i
If the recognition was "we the people," then the first six alternates might look like the following. Notice that the first alternate is the recognized word or phrase.
Alternates #0: we the peopleYou are reading help file online using chmlib.com
|