Math

Answered

Math replace comma to dot when exporting in "application/vnd.myscript.jiix" format

Hey! I am using myscript web math in my app, so when i try to write for example "1,2" i get "1.2" when exporting in application/vnd.myscript.jiix format, but for application/x-latex format it is exports with comma. I need to be it comma for application/vnd.myscript.jiix format.

image

image

image



Best Answer

Dear Vadim,


currently, as said above, the Math recognition cannot recognize such pattern.


I then allowed myself to create a custom ludef, which shall be used with the text recognition.


Please find the compiled resource attached.


In order to use it, you shall first ensure you upload the resource on your dashboard: https://developer.myscript.com/docs/interactive-ink/latest/android/advanced/custom-recognition/


If you name it for example "MYCUST", you shall then call it accordingly in the text configuration ; I also recommend you disable the "addLKText".

You can then refer to the "websocket_text_custom_resources" to adapt the code accordingly (https://github.com/MyScript/iinkJS/blob/master/examples/v4/websocket_text_custom_resources.html)


You can then set the configuration as follows:

iink: {
text: {
configuration: {
addLKText: false,
customResources: ['MYCUST']
}
}
}


For information, the source of the resource:

digit=[0-9]
comma=[,]
dot=[.]
number={digit}*({dot}{digit}*)?
expr={number}({comma}{number})?
{expr}


Let us know if you have any question.


Best regards,


Olivier

res

Hi Vadim,


Thank you for your question.

You should tune your "math.solver.decimal-separator" to use comma.


So assuming that you are using iinkJS , the configuration would look like:


          iink: {
            math: {
              mimeTypes: [ 'application/vnd.myscript.jiix'],
              solver: {
                'decimal-separator': ','
              }
            }
          }

With this configuration, the label in the JIIX export has the comma as a separator, as in the attached snapshot.



Best regards,


Gwenaëlle




But when i write expression with dot i need it to be a dot

So imagine case where i need to write two numbers not as decimal numbers but just like two numbers divided by comma. In this case without 'decimal-separator': ',' i get one decimal number like "1.2", but if i set this 'decimal-separator': ',' then i will always get comma as separator

Thank you for your update.


If you are using a "Math" content type, MyScript iink expects the content to be a mathematical expression, ie a set of elements and rules according to the configured grammar.


When you indicate two numbers divided by comma, I understand that you mean two digits separated by a comma as a text separator, not a comma as a mathematical symbol.

Is my understanding correct?


Best regards,


Gwenaëlle


Yeah! Exactly. For example it can be pair into parentheses like "(1, 2)" but it comes with dot 

image

image

Dear Vadim,


currently, the Math content type is not adapted for such use-case.


What kind of text expression would you like to recognize?


Thank you,


Best regards,


Olivier

Hey! I would like to recognize just several numbers divided by comma 

Answer

Dear Vadim,


currently, as said above, the Math recognition cannot recognize such pattern.


I then allowed myself to create a custom ludef, which shall be used with the text recognition.


Please find the compiled resource attached.


In order to use it, you shall first ensure you upload the resource on your dashboard: https://developer.myscript.com/docs/interactive-ink/latest/android/advanced/custom-recognition/


If you name it for example "MYCUST", you shall then call it accordingly in the text configuration ; I also recommend you disable the "addLKText".

You can then refer to the "websocket_text_custom_resources" to adapt the code accordingly (https://github.com/MyScript/iinkJS/blob/master/examples/v4/websocket_text_custom_resources.html)


You can then set the configuration as follows:

iink: {
text: {
configuration: {
addLKText: false,
customResources: ['MYCUST']
}
}
}


For information, the source of the resource:

digit=[0-9]
comma=[,]
dot=[.]
number={digit}*({dot}{digit}*)?
expr={number}({comma}{number})?
{expr}


Let us know if you have any question.


Best regards,


Olivier

res
  • Support
  • Forums
  • Math
  • Math replace comma to dot when exporting in "application/vnd.myscript.jiix" format