MLKitDigitalInkRecognition Framework Reference

  • ML Kit's Digital Ink Recognition API supports recognizing drawings, emojis, and text in various languages and scripts using specific model identifiers.

  • Developers can choose from identifiers for symbol recognition (drawings, emojis, shapes) or written language recognition across numerous languages and scripts.

  • Each recognition model provides confidence scores for its results, allowing selection of the most likely interpretation or presentation of multiple options.

  • Due to the inherent ambiguity of handwriting, using multiple recognition candidates and incorporating user feedback is recommended for improved accuracy.

  • Language and script identifiers are declared as class properties within the DigitalInkRecognitionModelIdentifier class in Swift for easy access and usage within applications.

Constants

The following constants are available globally.

  • Autodraw symbol recognition model.

    Model similar to that used by www.autodraw.com for sketch recognition. Given a collection of strokes representing a drawing, returns a string identifying the object. Because of the inherent ambiguity in recognizing some drawings, it is recommended to use multiple candidates, for example by exposing them to the user and letting them decide.

    This recognition model provides scores via DigitalInkRecognitionCandidate.score.

    Declaration

    Swift

    class let autodraw: DigitalInkRecognitionModelIdentifier
  • Emoji symbol recognition model.

    Recognizes single Emoji characters and returns them as Unicode code points. Because of the inherent ambiguity in recognizing some drawings, it is recommended to use multiple candidates, for example by exposing them to the user and letting them decide.

    This recognition model provides scores via DigitalInkRecognitionCandidate.score.

    Declaration

    Swift

    class let emoji: DigitalInkRecognitionModelIdentifier
  • Shapes symbol recognition model.

    Given a collection of strokes representing a single shape, returns a string containing either RECTANGLE, TRIANGLE, ARROW, or ELLIPSE.

    This recognition model provides scores via DigitalInkRecognitionCandidate.score.

    Declaration

    Swift

    class let shapes: DigitalInkRecognitionModelIdentifier