Share via


InkRecognizerContext Class

InkRecognizerContext Class

Enables the ability to perform ink recognition, retrieve the recognition result, and retrieve alternates. The InkRecognizerContext enables the various recognizers that are installed on a system to use ink recognition to process input appropriately.

Members

Enumeration Description
InkRecognitionModes Defines values that specify how the recognizer interprets the ink and determines the result string.
InkRecognizerCharacterAutoCompletionMode Defines values that specify types of character input modes.
Event Description
Recognition Occurs when the InkRecognizerContext has generated results from the BackgroundRecognize method.
RecognitionWithAlternates Occurs when the InkRecognizerContext has generated results after calling the BackgroundRecognizeWithAlternates method.
Method Description
BackgroundRecognize Specifies that the recognizer should recognize the associated strokes and fire a Recognition event when recognition is complete.
BackgroundRecognizeWithAlternates Specifies that the recognizer should recognize the associated strokes and fire a RecognitionWithAlternates event when recognition is complete.
Clone Creates a duplicate InkRecognizerContext.
EndInkInput Ends ink input to the InkRecognizerContext.
IsStringSupported Indicates whether the system dictionary, user dictionary, or word list contain a specified string.
Recognize Performs recogntion on an InkStrokes collection and returns recognition results.
StopBackgroundRecognition Ends background recognition that was started with a call to BackgroundRecognize or BackgroundRecognizeWithAlternates.
Property Description
CharacterAutoCompletion Gets or sets the character Autocomplete mode, which determines when characters or words are recognized.
Factoid Gets or sets the string name of the factoid used by the InkRecognizerContext object.
Guide Gets or sets the InkRecognizerGuide to use for ink input.
PrefixText Gets or sets the characters that come before the InkStrokes collection in the InkRecognizerContext object.
RecognitionFlags Gets or sets the flags that specify how the recognizer interprets the ink and determines the result string.
Recognizer Gets or sets the IInkRecognizer object used by the InkRecognizerContext object.
Strokes Gets or sets the InkStrokes collection associated with the InkRecognizerContext object.
SuffixText Gets or sets the characters that come after the InkStrokes collection in the InkRecognizerContext object.
WordList Gets or sets the InkWordList object that is used to improve the recognition results.

Remarks

This object can be instantiated by calling the CoCreateInstance method in C++ or by using the New keyword in Microsoft® Visual Basic® 6.0.

There are two types of recognition: background (asynchronous) or foreground (synchronous). Background recognition is started by a call to the BackgroundRecognize or BackgroundRecognizeWithAlternates methods, occurs on a background thread, and reports results to the application through an event mechanism. Foreground recognition does not return until all recognition is completed, thus making recognition results available to the calling thread without listening for the recognition event.

Ink is processed continuously in the background. If a IInkStrokeDisp is added to the InkStrokes collection to which the InkRecognizerContext refers, then the IInkStrokeDisp is then recognized immediately. See remarks in the EndInkInput method topic for more details.

All recognition occurs through a recognizer context. The context defines the settings for a single recognition session. It receives the ink that must be recognized and defines the constraints on the ink input and on the recognition output. The constraints that can be set on the context include the language, the dictionary, and grammar that is being used.

Note: Setting properties other than the Strokes or CharacterAutoCompletion properties succeeds only if the InkStrokes collection is NULL (Nothing in Visual Basic 6.0). You must set the other properties before you attach the InkStrokes collection to the InkRecognizerContext, or you must set the InkStrokes collection to NULL and then set the other properties. If you set the InkStrokes collection to NULL and then set the other properties, you may have to reattach the InkStrokes collection. This is because the recognition starts right after you assign the InkStrokes to the InkRecognizerContext. When a call is made to Recognize or BackgroundRecognize, call results might be available already.

To improve your application's performance, dispose of your InkRecognizerContext object when it is no longer needed.

COM Implementation

This object implements the IInkRecognizerContext COM interface.