Page Summary
-
MLKDigitalInkRecognizerperforms handwriting recognition on digital ink, which is a vector representation of user writing composed of strokes and touch points. -
It's initialized using
digitalInkRecognizer(options:)with specific options defined inDigitalInkRecognizerOptions. -
Recognition is done through
recognizeInk:completion:orrecognizeInk:context:completion:, the latter offering better accuracy by using context like writing area size and previously entered text. -
Recognition results are returned via a callback function (
DigitalInkRecognizerCallback) with a list of candidate strings. -
Providing context through
DigitalInkRecognitionContextcan help disambiguate recognition and improve accuracy, especially when building upon previous recognitions.
MLKDigitalInkRecognizer
@interface MLKDigitalInkRecognizer : NSObjectObject 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 Ink for
details.
-
Unavailable. Use
digitalInkRecognizer(options:)instead.Declaration
Objective-C
- (nonnull instancetype)init; -
Creates a
DigitalInkRecognizerobject using the specified options.See
DigitalInkRecognizerOptionsfor details.Declaration
Objective-C
+ (nonnull MLKDigitalInkRecognizer *)digitalInkRecognizerWithOptions: (nonnull MLKDigitalInkRecognizerOptions *)options; -
Performs a recognition of the input ink.
Note that using
recognize(ink:context:completion:)instead of this method may lead to better accuracy in some cases.Declaration
Objective-C
- (void)recognizeInk:(nonnull MLKInk *)ink completion:(nonnull MLKDigitalInkRecognizerCallback)completion;Parameters
inkInput to be recognized.
completionA callback for returning recognition candidates. See
DigitalInkRecognizerCallbackfor details. -
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 in the text area. 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
DigitalInkRecognitionContextfor details.Declaration
Objective-C
- (void)recognizeInk:(nonnull MLKInk *)ink context:(nonnull MLKDigitalInkRecognitionContext *)context completion:(nonnull MLKDigitalInkRecognizerCallback)completion;Parameters
inkInput to be recognized.
contextSee
DigitalInkRecognitionContextfor details.completionA callback for returning recognition candidates. See
DigitalInkRecognizerCallbackfor details. If nothing can be recognized, an empty list of candidates will be passed to the callback.