Recognizers
The recognizers aim at performing real-time incremental recognition on transient ink.
Setup
In order to use the recognizers, you need to:
- Create an IINKEngine object.
- Set the value of the
recognizer.configuration-manager.search-pathkey to the folder(s) containing your Recognizer configuration file(s) (*.conf). - Create your IINKRecognizer object by indicating its type (either
Text,Shape,Math,Raw ContentorGesture), and can then send PEN events to it. - You should add a IINKRecognizerDelegate delegate to the IINKRecognizer. When a recognition result has changed, an event notifies the IINKRecognizerDelegate with the resultChanged method. When an error occurs during the recognition process, an event notifies the IINKRecognizerDelegate with the
onError:method.
Configuration
Text Recognizer
- The recognition configuration for the Text Recognizer is based on the same principles and language resources as the Engine configuration, except that it uses dedicated configuration keys with a
recognizer.prefix : For instance,recognizer.langis used to configure the recognition language. - By default, text guides are disabled, but you can enable the guides of a Text Recognizer via the
recognizer.text.guides.enablekey. In addition, you can tune their spacing and start origin. - By default, the Text Recognizer recognizes both "classical" handwriting, whether print or cursive. But its configuration can be changed to recognize superimposed handwriting: To learn more, check MyScript ready-to use resources section.
Gesture Recognizer
Supported gestures are defined thanks to recognizer.gesture. prefixed keys.
Shape Recognizer
- To use the Shape Recognizer, you must deploy the shape resources in your application. They are contained in the
myscript-iink-recognition-shape.zippackage. - By default, the shape beautification is enabled: the beautification process consists in aligning shapes with each other, connecting shapes that almost touch each other and scaling shapes having close sizes.
You can disabled the shape beautification with the
recognizer.shape.beautification.enable.
Math Recognizer
To use the Math Recognizer, you must deploy the corresponding Math resources in your application. They are contained in the myscript-iink-recognition-math2.zip package.
Raw Content Recognizer
To use the Raw Content Recognizer, you must:
- Deploy the document layout analysis resources that are contained in the
myscript-iink-recognition-raw-content2.zippackage. - Define the classification configuration of your Recognizer with the
recognizer.raw-content.classificationproperty according to your needs, to control the list of content types that can be identified by the ink strokes classifier. - Define the recognition configuration of your Recognizer with
recognizer.raw-content.recognition, to control the list of content types that are recognized after classification. - If you want to perform text recognition, define your recognition language with the
recognizer.langproperty. - Deploy the resources packages according to your recognition configuration:
In addition to the myscript-iink-recognition-raw-content2.zip package, the following table lists resources that you must deploy in your project according to the recognition types that you use:
| Recognition content type | Required configuration bundles | Resource and configuration package names |
|---|---|---|
text | ${recognizer.lang} | Language package defined by your recognizer.lang configuration. See principles of language resources |
math | math2 | myscript-iink-recognition-math2.zip |
shape | shape | myscript-iink-recognition-shape.zip |
- Classification and recognition results are available in JIIX format.
We have added an
export.jiix.rangesparameter that allows you to get ink ranges corresponding to result objects in the JIIX result file. It is theoretically possible to do this matching by enablingexport.jiix.strokes, but then you will have to match the input strokes by their channel values, which can be tricky. Also,export.jiix.strokesproduces huge JIIX output whileexport.jiix.rangesis much more concise. So when using a Raw Content Recognizer, we recommend you to setexport.jiix.strokestofalseandexport.jiix.rangestotrue.
➤ For more details, refer to the configuration and jiix pages.
Common parameters
recognizer.result.default-formatdefines the format of the result provided via the IINKRecognizerDelegate resultChanged method. To get the available list of formats, use the IINKRecognizer supportedResultMimeTypes method.
- When performing batch recognition, it is now possible to configure the maximum number of threads to be used by the engine for
TextandMathRecognizers, by settingmax-recognition-thread-countconfiguration value to the number of threads to be used (default is 1). This tuning might be relevant when sending at one time, a large set of strokes that you have previously collected, to optimize the usage of CPU cores. It is advised however, to leave this configuration to 1 if you are doing incremental recognition, as it may have a negative impact on performances and accuracy.
➤ Refer to the configuration page, to get the full list of recognizer configuration.
Example
The write to type example gives you a hint how to implement scribble like feature relying on the Recognizer API of iink SDK. It is available on the MyScript Git repository containing the additional examples for the Android platform.
It is based on a contextless gesture recognition combined with a text recognition. To run both recognitions simultaneously, two instances of Recognizer are created - one for Gesture recognition and the other one for Text recognition.
➤ Should you need more details, refer to the API documentation and/or contact our support team.