MathCAT: Math Capable Assistive Technology

is a library that supports conversion of MathML to:

• Speech strings with embedded speech engine commands
• Braille (Nemeth and eventually other braille math codes)
• Navigation of math (in multiple ways including overviews)

A goal of MathCAT is to be an easy to use library for screen readers and other assistive technology to use to produce high quality speech and/or braille from MathML. It is a follow-on project from MathPlayer (see below) and uses lessons learned from it to do to produce even higher quality speech, navigation, and braille. MathCAT takes advantage of some new ideas the MathML Working Group is developing to allow authors to express their intent when they use a notation. E.g., $(3, 6)$ could be a point in the plane or an open interval, or even a shorthand notation for the greatest common divisor. When that information is conveyed in the MathML, MathCAT will use it to generate more natural sounding speech.

Todo: incorporation of third party libraries to support a common subset of TeX math commands along with ASCIIMath.

MathCAT is written in Rust and can be built to interface with C/C++, Python, and other languages. The Python interface is used by an NVDA add-on and I hope to eventually get it incorporated into Orca which is written in Python. There is also a C/C++ interface.

MathCAT uses a number of heuristics that try to repair poor MathML and put it in a recommended format. For example, TeX converters and WYSIWYG editors will take “1,234+1” and break the number “1,234” apart at the comma. MathCAT recognizes that and folds the number into a single mn. Other repairs are structural such as creating mrows based on information from MathML’s operator dictionary and adding invisible function application, multiplication, addition (mixed fractions), and separators (e.g, between the $i$ and $j$ in $a_{ij}$) when it seems appropriate. This simplifies speech and Nemeth generation and may be useful to other apps. Currently the cleanup is not exposed in an API, but potentially it could be another service of MathCAT. In general, MathCAT is somewhat conservative in its repair. However, it likely will do the wrong thing in some cases, but the hope is it does the right thing much, much more frequently. Finding common mistakes of translators to MathML and patching up the poor MathML is an ongoing project.

Current Status (updated 6/22)

MathCAT is under active development. Initial speech, navigation, and Nemeth generation is complete and NVDA add-on now exists. It should be usable as a MathPlayer replacement for those using the English version. It is not as complete or polished in some ways as MathPlayer though. However, it supports both Nemeth and UEB technical braille generation. The Nemeth braille is substantially better than that provided by MathPlayer and includes integration with navigation (uses dots 7 and 8 to indicate the navigation node).

A demo to show off some of MathCAT’s features and also as an aid for debugging was developed. Visit the demo and please report any bugs you find. This demo is not how AT users will typically interact with MathCAT but does show features that AT can potentially expose to end users such as highlighting of the speech, navigation, and braille.

Timeline (Starting 2020):

• ✓ December/early January: prototype usage of preliminary MathML WG proposal for “intent”
• ✓ January: Distribute MathCAT to a small group of students and other users for feedback and bug reports
• ✓ February/March: Work on MathML->UEB translation
• ✓ April: Prosody implementation/compatibility with SAPI, One Core, eSpeak, and Eloquence voices
• late April/May: add more intent inference rules (ongoing)
• ✓ May: Release MathCAT as NVDA add-on
• ✓ June: C/C++ interface for MathCAT
• ✓ Late spring/summer: develop GUI interface for setting user preferences
• July: vacation 😎
• Aug/Sept: work on UEB->MathML translation and explore UEB->Nemeth math translator
• Fall: potentially work on 2D Nemeth generation along with Nemeth input
• Nov/Dec: Work on at least one translation of MathCAT to another language (pushed back from late spring)
• Winter, Spring: work with translators to hopefully add many languages

These plans are very tentative and will likely change based on feedback from users and AT developers. I also have commitments for working on the MathML spec, so that can also delay some of these dates. A broken ankle also slowed me down considerably in the spring.

Documentation for different MathCAT Users

There are many different audiences for MathCAT and each audience has different interests/needs. Please see the following documentation for details based on your needs:

Why MathCAT?

MathCAT is a follow-on to MathPlayer. I developed MathPlayer’s accessibility while at Design Science starting back in 2004 after I joined Design Science. At the time, MathPlayer was chiefly designed to be a C++ plugin to Internet Explorer (IE) that displayed MathML on web pages. For quite some time, it was the most complete MathML implementation available. The original work for display of math was done by Design Science’s founder Paul Topping and their chief technology officer, the late Robert Miner. Eventually, for numerous reasons, IE withdrew the interface that MathPlayer used for display and did not implement a replacement as the world was moving towards using JavaScript in the browser and not allowing security threats posed by external code. This left MathPlayer as an accessibility-only library called by other programs (chiefly NVDA). MathPlayer was proprietary, but was given away for free.

In 2016, I left Design Science. In 2017, WIRIS bought Design Science. I volunteered to add bug fixes for free to MathPlayer and initially they were supportive of that. But when it came time to do a release, a number of the people around at the time of the buyout had left and the remaining team was not interested in supporting MathPlayer. That decision was not finalized until late 2020. In 2021, I started work on a replacement to MathPlayer. As a challenge, I decided to learn Rust and did the implementation in Rust. For those not familiar with Rust, it is a low level language that is type safe and memory safe, but not automatically garbage collected or reference counted. It is often touted as a safer replacement to C/C++.

Rust is quite efficient. On a Core I7-770K machine (higher end processor circa 2017), the moderate-size expression

${e}^{-\frac{1}{2}{\left(\frac{x-\mu }{\sigma }\right)}^{2}}$

takes about 1ms to generate the ClearSpeak string “e raised to the exponent, negative 1 half times; open paren; the fraction with numerator; x minus mu; and denominator sigma; close paren squared, end exponent” along with the Nemeth braille string “⠑⠘⠤⠹⠂⠌⠆⠼⠈⠡⠷⠹⠭⠤⠨⠍⠌⠨⠎⠼⠾⠘⠘⠆”. The MathML for this expression is:

$<mrow> <msup> <mi>e</mi> <mrow> <mo>&#x2212;</mo> <mfrac> <mn>1</mn> <mn>2</mn> </mfrac> <msup> <mrow> <mrow> <mo>(</mo> <mrow> <mfrac> <mrow> <mi>x</mi> <mo>&#x2212;</mo> <mi>&#x03BC;</mi> </mrow> <mi>&#x03C3;</mi> </mfrac> </mrow> <mo>)</mo> </mrow> </mrow> <mn>2</mn> </msup> </mrow> </msup> </mrow>$


MathCAT uses external rules to generate speech and braille. These take about 35ms to load; this load only happens the first time the rules are used, or if the speech style, language, or other external preference is changed. An additional 50ms are required to load the full Unicode files for speech and braille, but studies have shown that a vast majority of English K-14 math material uses a surprisingly few number of characters. Using open source math books, the initial load should cover at least 99.99% of the characters used in expressions encountered in English K-14 math textbooks.

The library is about 2.6mb in size.

If you are working on an in-browser solution (i.e, you are using JavaScript or some other browser-based language), MathCAT is probably not the best tool for you (although I will probably add a Javascript interface). Instead, take a look at Speech rule engine (SRE) by Volker Sorge. It is written in TypeScript and will likely meet your needs for an in-browser solution.

Acknowledgements

Several people helped out in various ways with the project:

• David Carlisle – provided invaluable help figuring out some xpath matches
• Susan Jolly – provided lots of patient guidance on Nemeth and UEB generation along with feedback on what is right and wrong.
• Murray Sargent and Volker Sorge – provided tables of Nemeth translations of characters and Nemeth tests

Translators: This has yet to be done, but initial translations will come from MathPlayer. I hope others will help out so I can list you here…