ISpeechPhraseInfo GetDisplayAttributes Method

Microsoft Speech SDK

Intelligent Interface Technologies Home Page Microsoft Speech SDK

Speech Automation 5.1

Object: ISpeechPhraseInfo

GetDisplayAttributes Method


The GetDisplayAttributes method returns the display attribute for the text.

The display attribute is the padding of white spaces before or after each word as determined by the engine. The speech recognition engine determines this value for the language used. Western scripts commonly use spaces between words, although eastern languages may not. Default is SDA_One_Trailing_Space.


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

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 retrieve to determine spacing. 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. For more information on replacements, see the SR Engine White Paper.

Return Value

The GetDisplayAttributes method returns a SpeechDisplayAttributes variable.


Example

In the following example, a successful recognition occurs. The variable theAttributes contains the white space attributes for the entire string. The attributes of a portion of the string could be chosen as shown in the subsequent example call. 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
	Dim theAttributes as SpeechDisplayAttributes

	theAttributes = RecoResult.PhraseInfo.GetDisplayAttributes
	theAttributes = RecoResult.PhraseInfo.GetDisplayAttributes( 2, 1, True )
End Sub