GithubHelp home page GithubHelp logo

saurabh2590 / mathjax-node-sre Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pkra/mathjax-node-sre

0.0 2.0 0.0 21 KB

A wrapper around mathjax-node and speech-rule-engine

License: Apache License 2.0

JavaScript 100.00%

mathjax-node-sre's Introduction

mathjax-node-sre Build Status

Greenkeeper badge

This module extends mathjax-node using speech-rule-engine.

It can be used as a drop-in replacement for mathjax-node.

Use

npm install mathjax-node-sre

to install mathjax-node-sre and its dependencies.

features

mathjax-node-sre provides three features.

drop-in replacement for mathjax-node

mathjax-node-sre can be used as a drop-in replacement of mathjax-node, so just import start, config, and typeset as you would with mathjax-node.

In addition to the usual mathjax-node configuration options, mathjax-node-sre accepts

speakText: false,               // adds spoken annotations to output
speakRuleset: "mathspeak",      // set speech ruleset; default (= chromevox rules) or mathspeak
speakStyle: "default",          // set speech style for mathspeak rules:  default, brief, sbrief)
semantic: false,                // adds semantic tree information to output
minSTree: false,                // if true the semantic tree is minified
enrich: false                   // replace the math input with MathML resulting from SRE enrichment

post-processor

mathjax-node-sre provides a postprocessor which expects mathjax-node output together with a configuration object containing the above options (except enrich) to add speech-text to mathjax-node output.

For example,

const mj = require('mathjax-node').typeset;
const postprocessor = require('mathjax-node-sre').postprocessor;

mj({math: 'x + y', format: "TeX", mml: true},function(result){
  postprocessor({speakText: true}, result, function(output){
    console.log(output.speakText) // => x plus y
  })
});

pre-processor

mathjax-node-sre provides a preprocessor which expects mathjax-node input and replaces the input with the result of (if necessary converting to) MathML and enriching the MathML with SRE.

For example:

var preprocessor = require('mathjax-node-sre').preprocessor;
preprocessor({ math: 'x^2', format: "TeX"}, function(output){
    console.log(output.math) // => <math xmlns="http://www.w3.org/1998/Math/MathML" display="block" alttext="x^2"><msup data-semantic-type="superscript" data-semantic-role="latinletter" data-semantic-id="2" data-semantic-children="0,1"><mi data-semantic-type="identifier" data-semantic-role="latinletter" data-semantic-font="italic" data-semantic-id="0" data-semantic-parent="2">x</mi><mn data-semantic-type="number" data-semantic-role="integer" data-semantic-font="normal" data-semantic-id="1" data-semantic-parent="2">2</mn></msup></math>
})

mathjax-node-sre's People

Contributors

greenkeeper[bot] avatar pkra avatar saurabh2590 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.