AI-generated Key Takeaways
-
This documentation details globally available classes for digital ink recognition within ML Kit.
-
These classes provide functionality for recognizing handwritten text from user input, including representing ink strokes, managing recognition models, and handling recognition results.
-
MLKDigitalInkRecognizeris the core class used to perform the recognition, utilizing models likeMLKDigitalInkRecognitionModeland options defined byMLKDigitalInkRecognizerOptions. -
Input is represented by
MLKInk, comprising ofMLKStrokeobjects made up ofMLKStrokePointinstances, whileMLKDigitalInkRecognitionResultencapsulates the recognition output with candidate interpretations (MLKDigitalInkRecognitionCandidate). -
MLKDigitalInkRecognitionContextprovides contextual information for improved recognition, andMLKWritingAreadefines properties of the user's writing space.
Classes
The following classes are available globally.
-
Individual recognition candidate.
A recognizer usually provides several recognition alternatives. This object represents one such alternative.
See
DigitalInkRecognitionResultfor more details.Declaration
Objective-C
@interface MLKDigitalInkRecognitionCandidate : NSObject -
Information about the context in which an ink has been drawn.
Pass this object to a
DigitalInkRecognizeralongside an ink to improve the recognition quality.Declaration
Objective-C
@interface MLKDigitalInkRecognitionContext : NSObject -
Represents a downloadable recognition model.
Recognition models are downloaded on the device when the
downloadmethod is called. The downloaded model is unzipped whenDigitalInkRecognizerloads it at inference time for the first time, which makes the first recognition a bit slower than subsequent ones.This object contains properties that are constant throughout the lifetime of a recognition model.
See
DigitalInkRecognitionContextfor the properties that depend on the ink being recognized.Declaration
Objective-C
@interface MLKDigitalInkRecognitionModel : MLKRemoteModel -
Represents a digital ink recognition model specific to a language, script, and optionally a regional variant.
Declaration
Objective-C
@interface MLKDigitalInkRecognitionModelIdentifier : NSObject -
Object representing the output of an ink recognition.
A recognizer usually provides several recognition alternatives, because the user intent is not always clear. For example, if the user writes a vertical line and then a circle, the recognition alternatives could include “10”, “IO”, and “lo”.
Alternatives are named “candidates”. This object represents a set of candidates as a list of
DigitalInkRecognitionCandidate.Use
DigitalInkRecognizerto perform the recognition itself. If nothing could be recognized, the propertycandidateswill be an empty array.Declaration
Objective-C
@interface MLKDigitalInkRecognitionResult : NSObject -
Object to perform handwriting 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
Inkfor details.Declaration
Objective-C
@interface MLKDigitalInkRecognizer : NSObject -
Options defining the behavior of a
DigitalInkRecognizer.Declaration
Objective-C
@interface MLKDigitalInkRecognizerOptions : NSObject -
A single touch point from the user.
Declaration
Objective-C
@interface MLKStrokePoint : NSObject -
Represents a sequence of touch points between a pen (resp. touch) down and pen (resp. touch) up event.
Declaration
Objective-C
@interface MLKStroke : NSObject -
Represents the user input as a collection of
Strokeand serves as input for the handwriting recognition task.Declaration
Objective-C
@interface MLKInk : NSObject -
A model that is stored remotely on the server and downloaded to the device.
Declaration
Objective-C
@interface MLKRemoteModel : NSObject -
Properties of the writing area.
The writing area is the area on the screen where the user can draw an ink.
Declaration
Objective-C
@interface MLKWritingArea : NSObject