Confidence Property

Confidence Property

Gets the level of confidence (strong, intermediate, or poor) that a recognizer has in the recognition of an IInkRecognitionAlternate object or of a gesture.

Declaration

[C++]

[propget] HRESULT get_Confidence ([out, retval] InkRecognitionConfidence*
    Confidence);

[Microsoft® Visual Basic® 6.0]

Public Property Get Confidence() As InkRecognitionConfidence

Property Value

InkRecognitionConfidence The level of confidence that a recognizer has in the recognition of an alternate or of a gesture.

This property is read-only.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER The parameter is an invalid pointer.
E_INK_EXCEPTION An exception occurred while processing.
E_NOTIMPL Confidence evaluation is not available with the selected recognizer.

Remarks

For a list of confidence values that may be returned, see the InkRecognitionConfidence enumeration type.

Note: Confidence evaluation is available for all gesture recognizers in the current release of Windows XP Tablet PC Edition.

RecognitionAlternate object:

If the alternate represents a phrase or sentence, the value represents the lowest confidence level of a recognition segment found in the phrase or sentence. However, if the alternate represents a word, the value represents the confidence level of the word.

Note: This property throws an exception if the IInkRecognizer that generates the IInkRecognitionAlternate does not support confidence levels.

Of the Microsoft recognizers, only the Microsoft English (US) Handwriting Recognizer and the Microsoft Gesture Recognizer support confidence levels. Third party recognizers may or may not support confidence levels.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example displays application and system gesture event information in a multiline text edit control, Text1, on the main form window.

Option Explicit
Dim WithEvents theInkCollector As InkCollector

Private Sub Form_Load()
    Set theInkCollector = New InkCollector
    theInkCollector.hWnd = Me.hWnd
    'Set the ink collection mode to collect ink and gestures,
    'and turn off all application gestures except the chevrons.
    theInkCollector.CollectionMode = ICM_InkAndGesture
    theInkCollector.SetGestureStatus IAG_AllGestures, False
    theInkCollector.SetGestureStatus IAG_ChevronUp, True
    theInkCollector.SetGestureStatus IAG_ChevronDown, True
    theInkCollector.SetGestureStatus IAG_ChevronLeft, True
    theInkCollector.SetGestureStatus IAG_ChevronRight, True
    theInkCollector.Enabled = True
    theInkCollector.SetEventInterest ICEI_SystemGesture, True
End Sub

Private Sub theInkCollector_Gesture( _
ByVal Cursor As MSINKAUTLib.IInkCursor, _
ByVal Strokes As MSINKAUTLib.InkStrokes, _
ByVal Gestures As Variant, _
Cancel As Boolean)
    Dim theGesture As Variant
    Dim X As Long
    Dim Y As Long
    Text1.Text = ""
    For Each theGesture In Gestures
        theGesture.GetHotPoint X, Y
        Text1.Text = Text1.Text & "Gesture " & _
        AppGestureName(theGesture.Id) & _
        " at (" & X & "," & Y & ") confidence: " & _
        ConfidenceName(theGesture.Confidence) & vbCrLf
    Next
End Sub

Private Sub theInkCollector_SystemGesture( _
ByVal Cursor As MSINKAUTLib.IInkCursor, _
ByVal Id As MSINKAUTLib.InkSystemGesture, _
ByVal X As Long, ByVal Y As Long, _
ByVal Modifier As Long, _
ByVal Character As String, _
ByVal CursorMode As Long)
    Text1.Text = "SystemGesture " & _
    SystemGestureName(Id) & " (x:" & X & ",y:" & Y & ")"
End Sub

Private Function SystemGestureName(ByVal Id As InkSystemGesture) As String
    Select Case Id
        Case ISG_DoubleTap
            SystemGestureName = "ISG_DoubleTap"
        Case ISG_Drag
            SystemGestureName = "ISG_Drag"
        Case ISG_HoldEnter
            SystemGestureName = "ISG_HoldEnter"
        Case ISG_HoldLeave
            SystemGestureName = "ISG_HoldLeave"
        Case ISG_HoverEnter
            SystemGestureName = "ISG_HoverEnter"
        Case ISG_HoverLeave
            SystemGestureName = "ISG_HoverLeave"
        Case ISG_RightDrag
            SystemGestureName = "ISG_RightDrag"
        Case ISG_RightTap
            SystemGestureName = "ISG_RightTap"
        Case ISG_Tap
            SystemGestureName = "ISG_Tap"
        Case Else
            SystemGestureName = "SystemGesture(" & Id & ")"
    End Select
End Function

Private Function AppGestureName(ByVal Id As InkApplicationGesture) _
As String
    Select Case Id
        Case IAG_AllGestures
            AppGestureName = "IAG_AllGestures"
        Case IAG_NoGesture
            AppGestureName = "IAG_NoGesture"
        Case IAG_ChevronUp
            AppGestureName = "IAG_ChevronUp"
        Case IAG_ChevronDown
            AppGestureName = "IAG_ChevronDown"
        Case IAG_ChevronLeft
            AppGestureName = "IAG_ChevronLeft"
        Case IAG_ChevronRight
            AppGestureName = "IAG_ChevronRight"
        Case Else
            AppGestureName = "AppGesture(" & Id & ")"
    End Select
End Function

Private Function ConfidenceName(ByVal Id As InkRecognitionConfidence) _
As String
    Select Case Id
        Case IRC_Strong
            ConfidenceName = "IRC_Strong"
        Case IRC_Intermediate
            ConfidenceName = "IRC_Intermediate"
        Case IRC_Poor
            ConfidenceName = "IRC_Poor"
        Case Else
            ConfidenceName = "Confidence(" & Id & ")"
    End Select
End Function

Applies To