ISpeechRecoResult PhraseInfo Property

Microsoft Speech SDK

Intelligent Interface Technologies Home Page Microsoft Speech SDK

Speech Automation 5.1

Interface: ISpeechRecoResult

PhraseInfo Property

The PhraseInfo property returns an ISpeechPhraseInfo structure containing detailed information about the last recognized phrase.

ISpeechPhraseInfo elements contains read-only data about timing for the phrase and audio stream, elements (words and phrases) in the recognized phrase, grammar and grammar rules information. The structure is used to examine the recognition information. It is also used by other calls such as ISpeechRecoResult.PhraseInfo.GetText to retrieve the phrase text.


Syntax

Set: (This property is read-only)
Get: ISpeechPhraseInfo = ISpeechRecoResult.PhraseInfo

Parts

ISpeechRecoResult
The owning object.
ISpeechPhraseInfo
Set: (This property is read-only)
Get: An ISpeechPhraseInfo variable that gets the property.

Example

The following code snippet assumes a previously defined RecoResult. If a completed recognition occurs, the code parses out selected information about stream times and element times. Although the preferred method of retrieving the text uses ISpeechRecoResult.GetText, this snippet not only retrieves the text on an element by element basis, but also retrieves the stream time associated with the word.

Dim rString As String
Dim i As Integer
Dim rp As ISpeechPhraseInfo
Set rp = RecoResult.PhraseInfo
        
If Not RecoResult Is Nothing Then
	rString = rString + "LangID= " & rp.LanguageId & vbCrLf
	rString = rString + "AudioBytes= " & rp.AudioSizeBytes & vbCrLf
	rString = rString + "AudioTime= " & rp.AudioSizeTime & vbCrLf

	For i = 0 To rp.Elements.Count - 1
		rString = rString + "Stream offset:" & rp.Elements(i).AudioStreamOffset & vbCrLf
		rString = rString + "Text form: " & rp.Elements(i).DisplayText & vbCrLf
		rString = rString + "Lex form: " & rp.Elements(i).LexicalForm & vbCrLf
	Next
End If