Share via


CustomRecognizerNode Class

Represents a ContextNode for a single recognition operation. All strokes and nodes that are under a CustomRecognizerNode object are recognized in an independent recognition operation and are not analyzed by the InkAnalyzer.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.dll)

Syntax

'Declaration
Public NotInheritable Class CustomRecognizerNode _
    Inherits ContextNode
'Usage
Dim instance As CustomRecognizerNode
public sealed class CustomRecognizerNode : ContextNode
public ref class CustomRecognizerNode sealed : public ContextNode
public final class CustomRecognizerNode extends ContextNode

Remarks

A CustomRecognizerNode node can contain he following types of child elements:

  • Any number of Unclassified Ink nodes.

  • Any number of Object nodes.

  • Any number of Line nodes.

  • Any number of InkWord nodes.

  • Any number of nodes with an unknown Guid value.

A CustomRecognizerNode object must be the direct child of the RootNode.

The simplest way to create a custom recognizer is to use InkAnalyzer.CreateCustomRecognizer to create the recognizer and InkAnalyzer.AddStrokesToCustomRecognizer to assign strokes to it. If any stroke that you add is already assigned to any node in the InkAnalyzer context tree, including an UnclassifiedInkNode, an ArgumentException is thrown. To avoid this, use InkAnalyzer.RemoveStroke or InkAnalyzer.RemoveStrokes to remove those strokes from the InkAnalyzer context tree before adding them to the custom recognizer.

Examples

The following example takes a Guid for a custom recognizer, customRecognizerId, and creates a CustomRecognizerNode with it for an InkAnalyzer, theInkAnalyzer. Strokes are then added from a Strokes collection, strokesForCustomAnalysis. Then Analyze is called and the recognized string is put into a TextBox, theResultsTextBox.

Dim customRecognizer As CustomRecognizerNode = _
    theInkAnalyzer.CreateCustomRecognizer(customRecognizerId)
theInkAnalyzer.AddStrokesToCustomRecognizer(strokesForCustomAnalysis, customRecognizer)

Dim theStatus As Microsoft.Ink.AnalysisStatus = theInkAnalyzer.Analyze()
theResultsTextBox.Text = customRecognizer.GetRecognizedString()
CustomRecognizerNode customRecognizer = 
    theInkAnalyzer.CreateCustomRecognizer(customRecognizerId);
theInkAnalyzer.AddStrokesToCustomRecognizer(strokesForCustomAnalysis, customRecognizer);

Microsoft.Ink.AnalysisStatus theStatus = theInkAnalyzer.Analyze();
theResultsTextBox.Text = customRecognizer.GetRecognizedString();

Inheritance Hierarchy

System.Object
  Microsoft.Ink.ContextNode
    Microsoft.Ink.CustomRecognizerNode

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 Server 2008 R2, Windows Server 2008

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

CustomRecognizerNode Members

Microsoft.Ink Namespace