iink SDK on Device



我现在想要使用 识别数学功能  我已经配置好了数学资源库  


以及通过 以下方式来输入 识别数据

editor.pointerEvents(events.toArray(new PointerEvent[0]), false);

现在我该怎么拿到 数学的识别结果    

之前我 识别文本 使用的是 

 trim = editor.export_(null, MimeType.TEXT, null); 可以返回文本结果


我想要拿到数学识别结果的 文本 以及 结果图片


Dear 磊 胡,

thank you for contacting us.

Currently, if I understand well, you would like to use the iink SDK to recognize Math?

First, I am not sure yo understand why you are using the "pointerEvents" API:
editor.pointerEvents(events.toArray(new PointerEvent[0]), false);

Indeed, the latter is rather for "offscreen non-interactive" ? Is it your case? If no, you shall refer to our GetStarted sample available on github: https://github.com/MyScript/interactive-ink-examples-android/tree/master/GetStarted

Then, you shall ensure you create a "Math" part rather than a "Text" part: https://developer.myscript.com/docs/interactive-ink/latest/android/fundamentals/storage/#working-with-parts

This way, by default it will load the corresponding math resources, with "standard" math configuration.

Also, you are trying to export a Text. In a Math part, instead you'd rather export as MathML or Latex (please find the list of available exports: https://developer.myscript.com/docs/interactive-ink/latest/overview/import-and-export-formats/#available-exports)

Now, here is the way you shall proceed (the below code is from the "GetStarted"):
String tempDir = getFilesDir().getPath() + File.separator + "tmp";
conf.setString("content-package.temp-folder", tempDir);
//set 2 digits for fractions
conf.setNumber("math.solver.fractional-part-digits", 2);

contentPackage = engine.createPackage(file);
//create a Math part
contentPart = contentPackage.createPart("Math");

//export as Latext
String JIIX = editorView.getEditor().export_(null, MimeType.LATEX);

Let us know if you have further questions.

Best regards,


是的 , 我正在使用  " 屏幕外非交互式"


通过  String JIIX = editorView.getEditor().export_(null, MimeType.LATEX);  得到了数学公式文本  

如果我输入化学  ,物理 ,相关公式 数据  进行识别  它是否可以正确识别 ? 

还有一个问题 :  得到识别结果之后  我该怎么获取到 识别结果 png 图像  ?

Dear 磊 胡,

Thank you for the update.

To answer your questions:
-Our technology has not been trained nor tuned to recognize chemistry, so it is not likely to return a proper result (you may give a try, but even setting a custom grammar, result will not be accurate).
For information, please find the list of supported Math elements and rules in a Math part: https://developer.myscript.com/docs/interactive-ink/1.5/overview/math-elements-and-rules/

-In order to export as image, we recommend you use the proper "export" function.

Using it, in a Math part, you can export as JPEG or PNG.

Best regards,



首先是输入的时候的设置Math类型有问题;不应该用 text.configuration.name


并且在使用这个参数之前最好先设置下 conf.setString("math.configuration.bundle", "你的math的.conf的Bundle-Name");


Login or Signup to post a comment