Share via


InkAnalyzerBase Class

Provides access to layout analysis, writing and drawing classification, and handwriting recognition.

Namespace:  System.Windows.Ink.AnalysisCore
Assembly:  IACore (in IACore.dll)

Syntax

'Declaration
Public Class InkAnalyzerBase _
    Implements IDisposable
'Usage
Dim instance As InkAnalyzerBase
public class InkAnalyzerBase : IDisposable
public ref class InkAnalyzerBase : IDisposable
public class InkAnalyzerBase implements IDisposable

Remarks

InkAnalyzerBase uses stroke packet data to analyze ink and does not interact with ink or stroke objects directly.

Warning

To avoid a memory leak, you must explicitly call the Dispose method on any InkAnalyzerBase object to which an event handler has been attached before the object goes out of scope.

To add strokes to or remove strokes from the InkAnalyzerBase for analysis, use the AddStroke, AddStrokes, RemoveStroke, or RemoveStrokes method. These methods update the DirtyRegion property, which is the region for which strokes are analyzed in the next analysis operation.

To analyze ink, use the Analyze or BackgroundAnalyze method. During analysis, the InkAnalyzerBase performs layout analysis, stroke classification, and handwriting recognition.

During analysis, the InkAnalyzerBase raises a number of events, including events generated during background analysis on the thread upon which the analyzer is created. Many InkAnalyzerBase events support the data proxy features of the InkAnalyzerBase. For more information, see Data Proxy with Ink Analysis.

To stop the analysis process from within an event handler, call the Abort method.

To modify the language the ink analyzer uses to recognize handwriting, use SetStrokeLanguageId or SetStrokesLanguageId. To modify how the ink analyzer classifies specific strokes, use SetStrokeType or SetStrokesType.

The InkAnalyzerBase loads all of the installed ink recognizers. The GetInkRecognizersByPriority method returns an InkRecognizerBaseCollection containing each available InkRecognizerBase. If more than one ink recognizer supports a specific language, use SetHighestPriorityInkRecognizer(InkRecognizer) to set which ink recognizer handles strokes of that language.

Using analysis hints can improve the recognition accuracy by providing extra context to the ink analyzer. The additional context information can help the ink analyzer narrow down the number of possible recognition results.  For example, you can scope down by defining factoids, expected words or structuring your input into a recognition guide. For more information on providing context to the ink analyzer, see

CreateAnalysisHint, DeleteAnalysisHint, and GetAnalysisHints.

The ink analyzer represents analysis results as a string or as a tree of ContextNodeBase objects. To access the recognized string, use GetRecognizedString. To access the root of the tree, use the RootNode property. The ink analyzer has the following methods for finding specific context nodes or text.

To work with alternate analysis results, use GetAlternates and ModifyTopAlternate.

To save analysis results, use SaveResults. To load saved results, use Load.

For more information about using the InkAnalyzerBase to analyze ink, see Ink Analysis Overview.

Examples

This example initializes a new InkAnalyzerBase, theInkAnalyzerBase. It then sets the AnalysisModes property and attaches a UpdateStrokesCacheBase event handler.

' Create the ink analyzer and enable automatic reconciliation and 
' automatic stroke cache cleanup, but not intermediate results. 
Dim theInkAnalyzerBase As New System.Windows.Ink.AnalysisCore.InkAnalyzerBase()
theInkAnalyzerBase.AnalysisModes = _
    System.Windows.Ink.AnalysisCore.AnalysisModes.AutomaticReconciliationEnabled _
    Or System.Windows.Ink.AnalysisCore.AnalysisModes.StrokeCacheAutoCleanupEnabled

' Since automatic stroke cache cleanup is enabled, add an event 
' handler for the UpdateStrokesCacheBase event. 
AddHandler theInkAnalyzerBase.UpdateStrokesCacheBase, _
    AddressOf theInkAnalyzerBase_UpdateStrokesCacheBase
// Create the ink analyzer and enable automatic reconciliation and 
// automatic stroke cache cleanup, but not intermediate results.
System.Windows.Ink.AnalysisCore.InkAnalyzerBase theInkAnalyzerBase =
    new System.Windows.Ink.AnalysisCore.InkAnalyzerBase();
theInkAnalyzerBase.AnalysisModes =
    System.Windows.Ink.AnalysisCore.AnalysisModes.AutomaticReconciliationEnabled
    | System.Windows.Ink.AnalysisCore.AnalysisModes.StrokeCacheAutoCleanupEnabled;

// Since automatic stroke cache cleanup is enabled, add an event 
// handler for the UpdateStrokesCacheBase event.
theInkAnalyzerBase.UpdateStrokesCacheBase +=
    new System.Windows.Ink.AnalysisCore.UpdateStrokesCacheBaseEventHandler(
        theInkAnalyzerBase_UpdateStrokesCacheBase);

Inheritance Hierarchy

System.Object
  System.Windows.Ink.AnalysisCore.InkAnalyzerBase

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkAnalyzerBase Members

System.Windows.Ink.AnalysisCore Namespace

System.Windows.Ink.AnalysisCore.AnalysisAlternateBase

System.Windows.Ink.AnalysisCore.AnalysisStatusBase

System.Windows.Ink.AnalysisCore.ContextLinkBase

System.Windows.Ink.AnalysisCore.ContextNodeBase