DigitalInkRecognizer

public interface DigitalInkRecognizer extends Closeable, LifecycleObserver

A DigitalInkRecognition client to perform recognition on digital ink.

Digital ink is the vector representation of what a user has written. It is composed of a sequence of strokes, each being a sequence of touch points (coordinates and timestamp). See Ink for details.

A DigitalInkRecognizer is created via getClient(DigitalInkRecognizerOptions).

Example:

DigitalInkRecognizer recognizer = DigitalInkRecognition.getClient(options);
 

This class can be used from any thread.

Public Method Summary

abstract void
close()
Frees all resources used by the recognizer.
abstract Task<RecognitionResult>
recognize(Ink ink)
Performs a recognition of the input ink using the default recognition context.
abstract Task<RecognitionResult>
recognize(Ink ink, RecognitionContext context)
Performs a recognition of the input ink using a recognition context.

Inherited Method Summary

Public Methods

public abstract void close ()

Frees all resources used by the recognizer. Calling any other method after this one will result in an error.

public abstract Task<RecognitionResult> recognize (Ink ink)

Performs a recognition of the input ink using the default recognition context.

Using the default recognition context may lead to sub-optimal recognition accuracy.

Parameters
ink Input to be recognized
Returns
  • A list of recognition candidates. If nothing can be recognized, this list will be empty.

public abstract Task<RecognitionResult> recognize (Ink ink, RecognitionContext context)

Performs a recognition of the input ink using a recognition context.

A recognition context contains information about the size of the writing area, and the characters that have already been entered. This helps disambiguate certain cases.

Example usage: a previous recognition has yielded the string "hello", that has been inserted in a text field. The user then handwrites "world". Send the present method the ink showing "world", and "hello" as a string in `context`. The recognizer will most likely return the string " world" with a leading space separating the two words.

See RecognitionContext for details.

Parameters
ink Input to be recognized
context See RecognitionContext for details.
Returns
  • A list of recognition candidates. If nothing can be recognized, this list will be empty.