Compartir a través de


ConfidenceAlternates Property

ConfidenceAlternates Property

Returns the collection of alternates in which each alternate in the collection consists of the segments with the same property values.

Declaration

[C++]

[propget] HRESULT get_ConfidenceAlternates (
    [out, retval] IInkRecognitionAlternates** RecognitionAlternates
);

[Microsoft® Visual Basic® 6.0]

Public Property Get ConfidenceAlternates() As IInkRecognitionAlternates

Property Value

IInkRecognitionAlternates Returns the IInkRecognitionAlternates collection of alternates, with each alternate in the collection having the same confidence value as this alternate. The method leaves the parameter intact if it fails.

This property is read-only.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER IInkRecognitionAlternates is an invalid pointer.
E_INVALIDARG The recognition range is invalid.
E_INK_EXCEPTION An exception occurred while processing.
E_OUTOFMEMORY Out of memory.

Remarks

This property is an alternative to the AlternatesWithConstantPropertyValues method. For more information about properties of alternates, see the RecognitionProperty constants.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example uses the ConfidenceAlternates property to display the alternates within the top alternate divided by confidence level boundaries for the recognized ink.

Option Explicit
Dim WithEvents theInkCollector As InkCollector
Dim WithEvents theRecognizerContext As InkRecognizerContext
Dim theStrokes As InkStrokes

Private Sub Form_Load()
    'Initialize the InkCollector
    Set theInkCollector = New InkCollector
    theInkCollector.hWnd = Me.hWnd
    theInkCollector.Enabled = True
    'Create new RecognizerContext
    Dim theRecognizers As New InkRecognizers
    Dim theRecognizer As IInkRecognizer
    Set theRecognizer = theRecognizers.GetDefaultRecognizer
    Set theRecognizerContext = theRecognizer.CreateRecognizerContext
    'Initialize the recognizer's strokes
    'and assign them to the RecognizerContext
    Set theStrokes = theInkCollector.Ink.Strokes
    Set theRecognizerContext.Strokes = theStrokes
End Sub

Private Sub theRecognizerContext_RecognitionWithAlternates( _
ByVal RecognitionResult As MSINKAUTLib.IInkRecognitionResult, _
ByVal CustomData As Variant, _
ByVal RecognitionStatus As MSINKAUTLib.InkRecognitionStatus)
    'Clear the list box
    List1.Clear
    'Get the set of alternates which are divided by
    'confidence level boundaries
    Dim theTopRecognitionAlternate As IInkRecognitionAlternate
    Set theTopRecognitionAlternate = RecognitionResult.TopAlternate
    Dim recoConstAlts As IInkRecognitionAlternates
    Set recoConstAlts = _
        theTopRecognitionAlternate.ConfidenceAlternates
    'Update the list box with the alternates
    Dim theRecognitionAlternate As IInkRecognitionAlternate
    For Each theRecognitionAlternate In recoConstAlts
        List1.AddItem (theRecognitionAlternate.String)
    Next
    'Save the recognition results with the strokes
    RecognitionResult.SetResultOnStrokes
End Sub

Private Sub theInkCollector_Stroke( _
ByVal Cursor As MSINKAUTLib.IInkCursor, _
ByVal Stroke As MSINKAUTLib.IInkStrokeDisp, _
Cancel As Boolean)
    'When a new stroke is collected, add it to
    'the RecognizerContext's strokes collection
    theStrokes.Add Stroke
    'Tell the RecognizerContext to recognize
    theRecognizerContext.BackgroundRecognizeWithAlternates
End Sub

Applies To