2

I am working on a web-based project to take images of math problems and evaluate them. The OCR I use to retrieve the math problems from the images only outputs LaTeX or Ascii Math (Currently using ASCII math), and I need to find a way to evaluate these problems.

For example, if I have

1(1)/(5)-:-1(1)/(3)

Then instead of displaying it, I would like to evaluate it. I have tried the evaluatex library, but I keep encountering an error with it:

VM2650 evaluatex.min.js:1 Uncaught Lexer error: can't match any token.

If anybody could point me to a better library, or tell me how to fix this error, that would be a great help.

Here's what I tried (In the chrome developer console):

evaluatex("(-1)/(5)-:(-1)/(3)")();

Thanks!

  • Please show a [mcve] of how you try to use evaluatex, including the input resulting in that error. – t.niese Mar 04 '20 at 07:25
  • The error seems to be coming from `-:` - where did these characters come from? They don't look like they would normally pop up in a mathematical statement. – kognise Mar 05 '20 at 15:40
  • the `-:` comes from ASCII math, it means to divide, here's a link to the syntax: http://asciimath.org/ –  Mar 05 '20 at 15:43
  • Looking through Evaluatex's issue list I found an issue relating to this that I presume you created. Until the maintainers update the code a possible janky fix would just be to do `.replace(/-:/g, '/')` – kognise Mar 05 '20 at 16:02

0 Answers0