Skip to content

Latest commit

 

History

History
127 lines (98 loc) · 4.92 KB

speech.md

File metadata and controls

127 lines (98 loc) · 4.92 KB

Speech

Number spacing issue

First, this is from the International System of Units spec concerning separating digits with spaces (emphasis mine):

"The practice of grouping digits in this way is a matter of choice; it is not always followed in certain specialized applications such as engineering drawings, financial statements and scripts to be read by a computer."

The International System of Units (PDF) (9th ed.). International Bureau of Weights and Measures. 2019. p. 150. ISBN 978-92-822-2272-0.

I take this to mean that the spacing has no meaning and is only to make it easier to read at a glance. Spoken numbers have natural separators like "thousand" and "million".

Adding spaces to the number using Unicode character x2009 (slimspace) causes speech-rule-engine (SRE) to add spaces to the number causing a number like 12345 (which looks like 12 345) to be read as "twelve three hundred and forty-five" instead of "twelve thousand three hundred and forty-five". Adding literal commas in place of the spaces will generate the correct reading, but using commas is not correct according to the SI rules.

This happens when:

  • MathJax parses LaTeX: 12\,345
  • MathML is generated manually (\u2009 is unicode slimspace):
    <mn>12\u2009345</mn>
  • Alternative MathML:
    <mrow>
        <mn>12</mn>
        <mo separator='true'>\u2009</mo>
        <mn>345</mn>
    </mrow>
  • Alternative MathML v2:
    <mrow>
        <mn>12</mn>
        <mspace width="thinspace" />
        <mn>345</mn>
    </mrow>

Pure MathML using <mn>12\u2009345</mn> is the best because this does not generate any <mo> multiplication in MathSpeak. However, it is still not read properly in ClearSpeak.

I'm not sure what else I can try, but it seems that ideally we would have spaces between numbers in plain tags be treated the same way commas are treated.

Bracketed uncertainty issue

Brackets in MathML seem to default to multiplication in SRE. For an uncertainty written in the form:

8.35(4)

This means that the last digit (5) has an uncertainty of plus or minus 4.

i.e. 8.35 +- 0.04

While MathSpeak just literally announces the brackets after the main number, ClearSpeak uses the word "times" which is incorrect.

One possible solution is to wrap the uncertainty section in an then define a class like "Bracketed-Uncertainty" (or something similar to "MathML-Unit") that could identify the start of the uncertainty so that it is interpreted correctly in SRE.

Ideally, this would change the operator that separates the number and the leading bracket for the uncertainty from multiplication to something else.

Units problem

MathJax with Speech-Rule-Engine does a fantastic job of creating speech in multiple languages for equations. There is some support for units by adding the MathML-Unit class to the <mi> tag (via \class{} in LaTeX format). However, it's limited.
Not every unit is represented. One option would be to expand the unit list in the Speech-Rule-Engine repo. However, there are other limitations. When reading out compound units, it is read as a mathematical equation using words like 'divided by' or 'start fraction __ over __ end fraction'. A more accepted way to read units is '__ per __'.

Examples with units represented in plain LaTeX and how they are translated for a screen reader:

plain LaTeX speech generated by MathJax interpreted LaTeX via siunitx
kg/s kilograms divided by seconds \kilogram\per\second
kg s^{-1} kilograms seconds superscript negative one \kilogram\per\second
\frac{kg}{s} start fraction kilograms over seconds end fraction \kilogram\per\second
lx^3 V T^3 el ex cubed volts tons cubed \cubic\lux\volt\tesla\cubed
H^{-5} aitch superscript negative five \per\henry\tothe{5}

To Resolve:

siunitx provides authors several ways to format units. The table lists the same unit three times, yet formatted three different ways. While the interpreted LaTeX can be written different, it can also be written exactly the same way but adjusted via options.

  • Is the formatting purely visual or does it provide meaning?
  • Would the author's initial interpreted LaTeX give the best meaning?
  • Can directly use the interpreted LaTeX as a shortcut for creating speech? (localization would be needed of course)

Numbers problem

In siunitx, numbers are formatted in many ways as well. For ease of reading, the default is to apply small spacing between groups of three numbers when the number is longer than 4 digits. However, the speech generator treats the space as starting a new number. But there are other problems:

  • Spacing treated as new numbers
  • Uncertainty with parentheses vs +-
  • Exponential notation
  • Negative numbers as bracketed numbers