iink SDK on Device

Answered

java.lang.IllegalArgumentException: Pointer events are not supported for this type of part: Text Document

What is the cause of this problem?It happens occasionally


Best Answer

Dear Shiftingsand,

thank you for the precision.

Currently, what is your exact use-case:
1-Do you have text areas with Chinese and English mixed?
2-Or you have areas with Chinese and others with English?

1-Indeed, in the first case, our iink sdk is able to recognize English mixed with Chinese. For that purpose, you shall ensure you set the Simplified Chinese language (or the traditional if needed): conf.setString("lang", "zh_CN");
Then the iink will normally recognize English words in Chinese sentences.

2-If the second case, then one way you could proceed is that you create a "Text Document" part: https://developer.myscript.com/docs/interactive-ink/1.4/android/fundamentals/editing/#block-management

Then, when the user is writing, he "chooses a pen" (e.g. en_US): then you create a new Text block, set the en_US language.
If the user chooses the zh_CN, you create a block setting the zh_CN language.

Or you can also use a "lasso" tool, to select the ink you want to recognize ; you are of course free to set the language you prefer: https://github.com/MyScript/interactive-ink-additional-examples-android/blob/master/java/samples/lasso/src/main/java/com/myscript/iink/sample/lasso/MainActivity.java

However, the accuracy of identification results is particularly low in frequent switching regions, and analysis is written and cleared at the same time.
>>normally, if guidelines and gestures are disable, iof you set the proper language and accuracy is properly set, there is not reason accuracy is low. Do you have ink samples for which accuracy is low?

Best regards,

Olivier


Dear Olivier,Thank you for reply !

Thank you very much for your suggestions  !  The previous problems have been resolved !

Best regards !

Answer

Dear Shiftingsand,

thank you for the precision.

Currently, what is your exact use-case:
1-Do you have text areas with Chinese and English mixed?
2-Or you have areas with Chinese and others with English?

1-Indeed, in the first case, our iink sdk is able to recognize English mixed with Chinese. For that purpose, you shall ensure you set the Simplified Chinese language (or the traditional if needed): conf.setString("lang", "zh_CN");
Then the iink will normally recognize English words in Chinese sentences.

2-If the second case, then one way you could proceed is that you create a "Text Document" part: https://developer.myscript.com/docs/interactive-ink/1.4/android/fundamentals/editing/#block-management

Then, when the user is writing, he "chooses a pen" (e.g. en_US): then you create a new Text block, set the en_US language.
If the user chooses the zh_CN, you create a block setting the zh_CN language.

Or you can also use a "lasso" tool, to select the ink you want to recognize ; you are of course free to set the language you prefer: https://github.com/MyScript/interactive-ink-additional-examples-android/blob/master/java/samples/lasso/src/main/java/com/myscript/iink/sample/lasso/MainActivity.java

However, the accuracy of identification results is particularly low in frequent switching regions, and analysis is written and cleared at the same time.
>>normally, if guidelines and gestures are disable, iof you set the proper language and accuracy is properly set, there is not reason accuracy is low. Do you have ink samples for which accuracy is low?

Best regards,

Olivier

Dear Olivier,Thank you for reply !


Sorry, my description may not be clear, the current project needs to identify only Chinese and English.On a page that has more than one region to write on, switching between regions clears the handwriting in the previous region.My current approach is to transfer the handwriting of the previous region to the recognition engine when switching regions.However, the accuracy of identification results is particularly low in frequent switching regions, and analysis is written and cleared at the same time.


Looking forward to your suggestions !


Dear Shiftinksand,


If I understand well, the user can for example write in a "Text" part, then swith to a "Math" part and use the same ink?


In that case, you have 2 possibilites:

-Either you save the pointer events on your side, and add these to the editor.

-Or you export as JIIX (by default, the strokes are exported in the JIIX file), and add the strokes contained in the JIIX to the editor.


Then, you shall add back the pointer events to the editor in your new part. Nevertheless, please note the following:

-If adding the strokes in a "Text" part, ensure you carefully follow the following recommendations (in particular, make sure you disable the guidelines and set the processGesture parameter to false): https://developer.myscript.com/docs/interactive-ink/1.4/android/advanced/off-screen-usage/#common-pitfalls

-If adding strokes from the JIIX file, as the coordinates of the JJIX are in milimters, you shall ensure to convert these is pixels ; this is done using the transform:

Transform tr= editor->getRenderer()->getViewTransform();
Point myPoint(x,y); //coordinates in milimeters
tr.apply(myPoint); //coordinates in pixels


Best regards,


Olivier

Thank you for reply !

According to the current project requirements, when I switch between two areas, I need to clear the handwriting of the last area. When users switch frequently, writing and clearing will occur at the same time, which will lead to inaccurate identification results. How to avoid this situation.

Looking forward to your suggestions



Dear Shiftinksand,


thank you for contacting us.


Currenlty, the pointer events cannnot be added to a "Text Document" part:https://developer.myscript.com/docs/interactive-ink/1.4/android/fundamentals/editing/#series-of-events


If you want to recognize text, you shall use a "Text" part.


Best regards,


Olivier