The recognizers aim at performing real-time incremental recognition on transient ink.
In order to use the recognizers, you need to:
Create an Engine object.
Set the value of the recognizer.configuration-manager.search-path
key to the folder(s) containing your Recognizer configuration file(s) (*.conf).
Create your Recognizer object by indicating its type (either Text
, Shape
, Math
or Gesture
), and can then send PEN events to it.
You should register a IRecognizerListener to the Recognizer. When a recognition result has changed, an event notifies the IRecognizerListener with the resultChanged method.
When an error occurs during the recognition process, an event notifies the IRecognizerListener with the onError
method.
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.lang
is 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.enable
key. 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.
Supported gestures are defined thanks to recognizer.gesture.
prefixed keys.
To use the Shape Recognizer, you must deploy the shape resources in your application. They are contained in the myscript-iink-recognition-shape.zip
package.
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
.
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.
Default Math resources are generally sufficient for most needs. However, in some cases, it may be necessary to use only a subset of Math symbols or rules. You can learn how to build your own resources files.
recognizer.result.default-format
defines the format of the result provided via the IRecognizerListener resultChanged method.
To get the available list of formats, use the Recognizer getSupportedResultMimeTypes method.
When performing batch recognition, it is now possible to configure the maximum number of threads to be used by the engine for Text
and Math
Recognizers,
by setting max-recognition-thread-count
configuration 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.
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. This sample comes with a description that helps you understand its principle.
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 documentation and/or ask question on our developer forum.