How to use the speech-rule-engine.processExpression function in speech-rule-engine

To help you get started, we’ve selected a few speech-rule-engine examples, based on popular ways it is used in public projects.

github mathjax / MathJax-node / lib / mj-page.js View on Github external
var SPEAK = function (svg) {
    var jax = MathJax.Hub.getJaxFor(svg), id = jax.inputID, mml;
    try {mml = jax.root.toMathML('',jax)} catch(err) {
      if (!err.restart) {throw err;} // an actual error
      if (!queue) {queue = MathJax.Callback.Queue()}
      return queue.Push(err.restart,window.Array(SPEAK,svg));
    }
    jax.speech = speech.processExpression(mml);
    svg.setAttribute("role","math");
    svg.setAttribute("aria-labelledby",id+"-Title "+id+"-Desc");
    for (var i = 0, m = svg.childNodes.length; i < m; i++)
      svg.childNodes[i].setAttribute("aria-hidden",true);
    var node = MathJax.HTML.Element("desc",{id:id+"-Desc"},[jax.speech]);
    svg.insertBefore(node,svg.firstChild);
    node = MathJax.HTML.Element("title",{id:id+"-Title"},["Equation"]);
    svg.insertBefore(node,svg.firstChild);
  }
  for (var i = nodes.length-1; i >= 0; i--) SPEAK(nodes[i]);
github mathjax / MathJax-node / lib / mj-page.js View on Github external
function AdjustMML() {
  if (data.renderer === "NativeMML") {
    var nodes = document.getElementsByClassName("MathJax_MathML");
    for (var i = nodes.length-1; i >= 0; i--) {
      var math = nodes[i].getElementsByTagName("math")[0]
      nodes[i].parentNode.replaceChild(math,nodes[i]);
      var alttext = speech.processExpression(math.outerHTML.replace(/&nbsp;/g,"\u00A0"));
      if (data.speakText) math.setAttribute("alttext",alttext);
    }
  }
}

speech-rule-engine

A standalone speech rule engine for XML structures, based on the original engine from ChromeVox.

Apache-2.0
Latest version published 5 days ago

Package Health Score

78 / 100
Full package analysis

Similar packages