ISpeechPhraseInfo GetText Method

Microsoft Speech SDK

Intelligent Interface Technologies Home Page Microsoft Speech SDK

Speech Automation 5.1

Object: ISpeechPhraseInfo

GetText Method


The GetText method returns the text from a recognition as a single string.


ISpeechPhraseInfo.GetText(
     [StartElement As Long = 0],
     [Elements As Long = -1],
     [UseReplacements As Boolean = True]
) As String

Parameters

StartElement
[Optional] Specifies the word position from which to start. If omitted, the first word is used.
Elements
[Optional] Specifies the number of words to retrieve. Default value is -1 indicating all words are retrieved.
UseReplacements
[Optional] Indicates if replacement text should be used. An example of a text replacement is speaking the sentence "write new check for twenty dollars." The retrieved replacement text is "write new check for $20." Default value is True. See the SR Engine White Paper for more information on replacements.

Return Value

The GetText method returns a String containing the words in the phrase.

Remarks

GetText may be used only after a recognition attempt, whether successful (SRERecognition), or unsuccessful (SREFalseRecognition).

Example

In the following example, a successful recognition occurs and displays in a text box. The code is inside a recognition event.

Private Sub RC_Recognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult)

	Set RecoResult = Result
	TextBox1.Text = RecoResult.PhraseInfo.GetText
End Sub