@interface MLKDigitalInkRecognitionContext : NSObject
Information about the context in which an ink has been drawn.
Pass this object to a
DigitalInkRecognizer alongside an ink to improve the recognition
Characters immediately before the position where the recognized text should be inserted.
This information is used by the recognizer’s language model to improve recognition.
Example: a text field contains “hello”, with the cursor right after “o”. The user handwrites something that looks like “world”. If the pre-context is set to “hello”, the recognizer will be able to output “ world”, with a leading space.
If the text field contains “hello” with the cursor between “e” and the first “l”, then the pre-context must be set to “he”.
A good rule of thumb for pre-context length is: as many characters as possible, including spaces, until around 20. The optimal number depends on the exact recognition model that is used. Getting the best speed/accuracy tradeoff may require a bit of tuning.
@property (nonatomic, readonly, nullable) NSString *preContext;
Size of the writing area.
This is used by some recognition models to disambiguate some cases. Example: lowercase vs. uppercase (“o” vs. “O”).
@property (nonatomic, readonly, nullable) MLKWritingArea *writingArea;
- (nonnull instancetype)init;
- (nonnull instancetype)initWithPreContext:(nullable NSString *)preContext writingArea: (nullable MLKWritingArea *)writingArea;
Characters immediately before the position where the recognized text should be inserted. See the description of the property with the same name for more details.
Properties of the region of the canvas where the ink has been drawn. See the description of the property with the same name for more details.