[go: nahoru, domu]

Skip to content

RESTful service to convert among different math formats - Latex, MathML and AsciiMath

Notifications You must be signed in to change notification settings

mingchen62/swiss_knife

Repository files navigation

node-Rest

Rest service to Convert different math formats: Latex to MathMl and a subset of MathML to ASCIIMathML.

installation

install node.js

see etc/install-node-centos.txt

install dependency packages

  npm install express  
  npm install body-parser  
  npm install winston  
  npm install mathml-to-asciimath
  npm install texzilla
  npm install xmlhttprequest
  npm install cors
  nop install ascii2mathml

Update local changes on mathml-to-asciimath.

$ cd node_modules
$ tar xvf ../mathml-to-asciimath.tar

test NODE.js installation

test the two conversion JS packages are correctly installed
% node

var convert = require('texzilla'); var lex ='x \leq y'; convert.toMathMLString(lex); var convert2 = require('mathml-to-asciimath'); var mathml = '1+2'; convert2(mathml); .exit

local test

There will be various REST end points for this service:
/mathml_to_asciimath
/latex_to_asciimath
/latex_to_mathml
/asciimath_mathml

test Rest service from same directory, local connection:
$ node client-test-latex.js
$ node client-test-mathml.js

test RESTful services

  1. test REST over network to make sure firewall is open; If not open, use 'ipTables' to check From another machine,
    Latex_toAsciiMath
    %curl -H "Content-Type: application/json;charset=UTF-8" -X POST -d '{"id":90,"asciimath":"", "mathml":"", "latex":"x \lt y"}' http://192.168.1.156:8089/latex_to_asciimath
    Asccimath to MathMl
    %curl -H "Content-Type: application/json;charset=UTF-8" -X POST -d '{"id":90,"asciimath":"x < y", "mathml":"", "latex":""}' http://192.168.1.156:8089/asciimath_to_mathml
    %curl -H "Content-Type: application/json;charset=UTF-8" -X POST -d '{"id":90,"asciimath":"sqrt((A+X)/2)/2", "mathml":"", "latex":""}' http://192.168.1.156:8089/asciimath_to_mathml

Simple performance test using Apache Benchmark

%echo '{"id":90,"asciimath":"", "mathml":"", "latex":"x \lt y"}' > post_loc.txt
%ab -p post_loc.txt -T application/json -c 5 -n 10 http://192.168.1.154:8083/latex_to_asciimath

About

RESTful service to convert among different math formats - Latex, MathML and AsciiMath

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published