Math

Answered

数学公式的输入能支持候选项应该如何配置

我们在使用IDK开发时,发现有些数学符号输入比较困难,比如 

image的识别结果会在imageimage之间摇摆,,数学公式的识别是否有提供类似 SetTextListSize 、SetWordListSize、SetCharListSize 这样可以从多个识别结果中进行选择的配置?我们尝试在math.conf文件中配置

image得到错误提示

image,请问数学公式识别的候选项该如何开启?


Best Answer

Dear 贵宾 李 ,

Thank you for your update.


The candidates feature for Math is not planned in our roadmap.


Regards,


Gwenaëlle


Dear 贵宾 李 ,

Thank you for your question.

Currently, the SetTextListSize, SetWordListSize and SetCharListSize are only for a Text configuration, not a Math configuration.

In your case, what has to be kept in mind is that our solution will return with what it considers as the closest result. In the below image, in my opinion, the "5" at the denominator resembles more to a "s" than a "5", which is why our Math recognizer returns with "s".


There is actually one rule to remember which is "the more you constrain, the better the recognition is likely to be".

First, I would recommend you create your own custom grammar, in which you would only keep the characters you expect (e.g. remove the letters and keep the digits). You can refer to the following part of the documentation: https://developer.myscript.com/docs/interactive-ink/1.3/android/advanced/build-custom-resources/#math
, and then compile it: https://developer.myscript.com/support/recognition-assets. You can also fine-tune it to only keep the expressions you expect (e.g. fractions, additions...)

Once compiled, you can add it into the assets of you project and to the math.conf, e.g.
Name: standard
Type: Math
Configuration-Script:
AddResource math/math-ak.res
AddResource math/myCustomGrammar.res


This way, recognition of the above is likely to be better, but keep in mind that a mis-written character is not likely to be well recognized.


Best regards,

Olivier

感谢您的回答。语法资源文件我们已经编写了,但是不能很好的解决我们的问题,我们目前是针对中国的初中学生提供的初中数学产品,需要学生在安卓端输入初中会用到的数学符号。有较多的样式相似,但含义完全不同的答案需要录入S和5只是举个例子。数学公式提供候选项对我们来说非常有必要,请问你们是否有计划支持数学公式的候选项,如果有的话,大概什么时间可以提供给安卓版本SDK使用。以下是我们编写的语法资源文件。

//大写字母

upcase = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

 

//小写字母

lowercase = a b c d e f g h i j k l m n o p q r s t u v w x y z

 

//数字

number = 0 1 2 3 4 5 6 7 8 9

 

//希腊字母

 

delt = Δ

 

greece = α β γ θ λ π ρ ω ϕ µ Σ

 

//左括号

leftpar = ( [ { |

 

//右括号

rightpar= ) ] } |

 

//运算符号

operation = = + - × ÷ * ± . % < > ≤ ≥ ≠ ≈ = , · … : ; ⊕ ⊗ ⊖ ⊙ & @

 

//最大最小

minmax = min max

 

ln = ln

 

log = log

 

operationStrat = + - ±

 

//度量单位

measurement = km hm dm cm mm µm ml kg mg MHz kHz Hz ¥ $

 

//上标

superscript = ' ''

 

geometricstart4 = sin cos tan cot

 

 

logzh ::= identity(log)

    | identity(ln)

    | subscript(log, danxiangshi)

 

//代数

//单个变量

xiabiaoshangbiao ::= identity(number)

                 | hpair(number,number)

                 | hpair(xiabiaoshangbiao,number)

singlevar ::= identity(lowercase)

                 | identity(greece)

                 | superscript(singlevar, superscript)

                 | superscript(singlevar, danxiangshi)

                 | superscript(singlevar, lowercase)

                 | subscript(singlevar, xiabiaoshangbiao)

                 | subsuperscript(singlevar, xiabiaoshangbiao, superscript)

                 | subsuperscript(singlevar, xiabiaoshangbiao, danxiangshi)

 

//单项式

danxiangshi ::= identity(singlevar)

                 | identity(number)

                 | identity(delt)

                 | hpair(danxiangshi,number)

                 | hpair(danxiangshi,singlevar)

                 | hpair(danxiangshi,danxiangshi)

                 | hpair(danxiangshi,operation)

                 | hpair(operationStrat,danxiangshi)

                 | hpair(danxiangshi,geometricstartzh11)

                 | fence(danxiangshi,leftpar,rightpar)

                 | superscript(danxiangshi,xiabiaoshangbiao)

                 | superscript(danxiangshi,danxiangshi)

                 | superscript(danxiangshi,fenshi)

                 | sqrt(danxiangshi)

                 | sqrt(delt)

                 | hpair(logzh,danxiangshi)

//分式

fenshi ::= fraction(danxiangshi,danxiangshi)

                 | hpair(logzh,fenshi)

                 | hpair(danxiangshi,fenshi)

                 | hpair(fenshi,operation)

                 | hpair(fenshi,danxiangshi)

                 | hpair(fenshi,fenshi)

                 | superscript(fenshi,xiabiaoshangbiao)

                 | superscript(fenshi,danxiangshi)

                 | superscript(fenshi,fenshi)

                 | fence(fenshi,leftpar,rightpar)

                 | hpair(fenshi,geometricstartzh11)

                 | hpair(operationStrat,fenshi)

                 | sqrt(fenshi)

 

 

//根式

cifang = 2 3

genshi ::= sqrt(danxiangshi)

                 | sqrt(fenshi)

                 | presuperscript(genshi,cifang)

                 | hpair(danxiangshi,genshi)

                 | hpair(fenshi,genshi)

                 | hpair(logzh,genshi)

 

 

 

//几何

//点

point ::= identity(upcase)

    | subscript(upcase, number)

    | superscript(upcase, superscript)

    | subsuperscript(upcase, number, superscript)

 

//坐标

zuobiaox = x

operationzuobiaox = + - = < > ≤ ≥ ≠ ≈

zuobiaoxzh ::= subscript(zuobiaox, point)

    | hpair(zuobiaoyzh, operationzuobiaox)

    | hpair(zuobiaoxzh, zuobiaoxzh)

zuobiaoy = y

operationzuobiaoy = + - = < > ≤ ≥ ≠ ≈

zuobiaoyzh ::= subscript(zuobiaoy, point)

    | hpair(zuobiaoyzh, operationzuobiaoy)

    | hpair(zuobiaoyzh, zuobiaoyzh)

 

//三角形、四边形

//几何符号

geometricstart1 = □ △ Rt△

sibianxing ::= identity(point)

    | hpair(point, point)

    | hpair(sibianxing, point)

operationsibian = ∼ ≅

geometricstartzh1 ::= hpair(geometricstart1,sibianxing)

    | hpair(geometricstartzh1, operationsibian)

    | hpair(geometricstartzh1, geometricstartzh1)

 

//面积

mianji = S

operationmianji = + - = < > ≤ ≥ ≠ ≈

geometricstartzh8 ::= subscript(mianji, geometricstartzh1)

    | hpair(geometricstartzh8, operationmianji)

    | hpair(geometricstartzh8, geometricstartzh8)

    | fraction(geometricstartzh8,geometricstartzh8)

    | hpair(geometricstartzh8, fenshi)

    | hpair(geometricstartzh8, danxiangshi)

 

//角

geometricstart2 = ∠

jiao ::= identity(point)

    | hpair(point, point)

    | hpair(jiao, point)

    | identity(number)

    | identity(greece)

operationjiao = + - = < > ≤ ≥ ≠ ≈

geometricstartzh2 ::= hpair(geometricstart2,jiao)

    | hpair(geometricstartzh2, operationjiao)

    | hpair(geometricstartzh2, geometricstartzh2)

    | fraction(geometricstartzh2,geometricstartzh2)

 

//三角函数

sanjiaohanshu ::= hpair(geometricstart4, geometricstartzh2)

    | hpair(geometricstart4,greece)

    | hpair(geometricstart4,point)

operationsanjiaohanshu = + - = < > ≤ ≥ ≠ ≈

geometricstartzh3 ::= identity(sanjiaohanshu)

    | hpair(geometricstartzh3, operationsanjiaohanshu)

    | hpair(geometricstartzh3, geometricstartzh3)

 

//直线

geometricstartzh5 ::= hpair(point, point)

    | identity(lowercase)

    | subscript(lowercase,number)

    | superscript(lowercase, superscript)

    | subsuperscript(lowercase, number, superscript)

operationsanzhixian = ∥ ⊥ + - =

geometricstartzh6 ::= identity(geometricstartzh5)

     | hpair(geometricstartzh6, operationsanzhixian)

     | hpair(geometricstartzh6, geometricstartzh6)

     | fraction(geometricstartzh6,geometricstartzh6)

     | hpair(geometricstartzh6, fenshi)

     | hpair(geometricstartzh6, danxiangshi)

 

//勾股定理

gougu = 2

operationgougu = + - =

geometricstartzh10 ::= superscript(geometricstartzh5, gougu)

    | hpair(geometricstartzh10, operationgougu)

    | hpair(geometricstartzh10, geometricstartzh10)

    | sqrt(geometricstartzh10)

 

//线段长度

changdu = l

operationchangdu = + - = < > ≤ ≥ ≠ ≈

geometricstartzh7 ::= subscript(changdu, geometricstartzh5)

    | hpair(geometricstartzh7, operationchangdu)

    | hpair(geometricstartzh7, geometricstartzh7)

    | fraction(geometricstartzh7,geometricstartzh7)

    | hpair(geometricstartzh7, fenshi)

    | hpair(geometricstartzh7, danxiangshi)

 

//圆

yuan = ⊙

geometricstartzh12 ::= hpair(yuan,point)

 

//弧

geometricstart5 = ⌒

hudu ::= hpair(point,point)

    |hpair(hudu,point)

operationhudu = + - =

geometricstartzh9 ::= overscript(hudu,geometricstart5)

    | hpair(geometricstartzh9, operationhudu)

    | hpair(geometricstartzh9, geometricstartzh9)

 

//向量

xiangliangfuhao = → ⇀ ⇁ -

operationxiangliang = + - =

xiangliang ::= overscript(geometricstartzh5,xiangliangfuhao)

    | hpair(xiangliang, operationxiangliang)

    | hpair(xiangliang, xiangliang)

 

//度分秒

degree = ∘ ' ''

numdegree ::= identity(number)

    | hpair(numdegree,number)

    | superscript(numdegree,degree)

operationdegree = + - =

geometricstartzh11 ::= identity(numdegree)

    | hpair(geometricstartzh11, operationdegree)

    | hpair(geometricstartzh11, geometricstartzh11)

 

 

geometricstart3 = ∼ ≅

geometricstart6 = ∥ ⊥

 

//单个输入

singleable ::= identity(upcase)

                | identity(lowercase)

                | identity(number)

                | identity(greece)

                | identity(operation)

                | identity(minmax)

                | identity(logzh)

                | identity(measurement)

                | identity(degree)

                | identity(geometricstart1)

                | identity(geometricstart2)

                | identity(geometricstart3)

                | identity(geometricstart4)

                | identity(geometricstart6)

 

expression ::= identity(singleable)

  | identity(singlevar)

  | identity(point)

  | identity(geometricstartzh1)

  | identity(geometricstartzh2)

  | identity(geometricstartzh3)

  | identity(geometricstartzh5)

  | identity(geometricstartzh6)

  | identity(geometricstartzh7)

  | identity(geometricstartzh8)

  | identity(geometricstartzh9)

  | identity(geometricstartzh10)

  | identity(geometricstartzh11)

  | identity(geometricstartzh12)

  | identity(danxiangshi)

  | identity(fenshi)

  | identity(genshi)

  | identity(xiangliang)

  | identity(zuobiaoxzh)

  | identity(zuobiaoyzh)

 

dakuohao = {

vlist2 ::= vlist(expression)

    |leftfence(vlist2,dakuohao)

 

//start symbol

start(vlist2)

 

 


Answer

Dear 贵宾 李 ,

Thank you for your update.


The candidates feature for Math is not planned in our roadmap.


Regards,


Gwenaëlle