Skip to content

canonicalize double exclamation !! to speak as double factorial - #837

Open
AdamMagued wants to merge 1 commit into
daisy:mainfrom
AdamMagued:fix/double-factorial-speech
Open

AdamMagued wants to merge 1 commit into
daisy:mainfrom
AdamMagued:fix/double-factorial-speech

Conversation

@AdamMagued

Copy link
Copy Markdown

Resolves #806.

When !! is encountered in <mo>!!</mo>, it was previously left as literal ASCII exclamation marks and spoken as "5 !!" rather than "5 double factorial".

This change:

  1. Canonicalizes "!!" to "\u{203C}" ("‼") in canonicalize_mo_text, aligning with the existing rules for double factorial across languages.
  2. Adds "‼" to operator-info.in with postfix operator type and priority 810 (matching single and double factorial operators).
  3. Adds a test in symbols_and_adornments.rs verifying that <math><mn>5</mn><mo>!!</mo></math> produces "5 double factorial" in ClearSpeak and SimpleSpeak.

@github-actions

Copy link
Copy Markdown
Linux library size: 0.58 MiB (0.00%)
Revision Release liblibmathcat.so
Base (3bbbd44) 0.58 MiB (605,312 bytes)
PR (846327e) 0.58 MiB (605,312 bytes)
Change 0 bytes (0.00%)

Built with default features, Rust 1.96.0, and Ubuntu 24.04. Workflow run.

@moritz-gross

moritz-gross commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

When I wrote this issue, I didn't even catch that it's already covered and just needs to be normalized.
PR looks good to me.

@NSoiffer what do you think? Also, I've not really worked with the operator-info.in table yet, but isn't there an easier/safer way to get this info? As I understand it, this is based on the W3C standard, which at this point even changed the priority in MathML4 to 820 instead of 810 (search for !, !!, %, ′, it's located in appendix B 3.1). To me, the ideal scenario would be a 3rd party knowledge base to use, just like we did with elements-rs for chemistry.
Couldn't we just parse https://github.com/w3c/xml-entities/blob/gh-pages/unicode.xml ?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

Speak !! as double factorial in MathML

2 participants