Skip to content

Fix "TEMP NAME of" when a parenthesized matrix is raised to a power (#762) - #763

Merged
NSoiffer merged 3 commits into
daisy:mainfrom
wittjeff:fix/762-nested-temp-name-wrapper
Sep 13, 2026
Merged

NSoiffer merged 3 commits into
daisy:mainfrom
wittjeff:fix/762-nested-temp-name-wrapper

Conversation

@wittjeff

Copy link
Copy Markdown
Contributor

Fixes #762.

A parenthesized matrix as the base of msup was spoken as "TEMP NAME of the 2 by 2 matrix; row 1; 1, 2; row 2; 3, 4; squared". The LuaLaTeX mspace/fence attributes in the report are not the cause: a plain <msup><mrow><mo>(</mo><mtable>…</mtable><mo>)</mo></mrow><mn>2</mn></msup> reads the same, and canonicalization yields a clean ( mtable ) mrow in both cases.

The intent tree is power( TEMP_NAME( matrix(…) ), 2 ). TEMP_NAME is the internal transport wrapper replace_nodes_tree puts around a bare x: replacement. The mrow matrix intent rule replaces with x: "*[2]" (not an intent:), so the mrow's result is TEMP_NAME(matrix); the power rule's x: "*[1]" wraps it again, and lift_children only stripped one level. The leftover wrapper then reaches the generic function-intent speech rule, which speaks its name.

Change: lift_children in src/speech.rs now flattens nested wrappers. A wrapper whose children are all elements is spliced recursively; a leaf wrapper holding text (from a Text or Attribute node) is still only unwrapped when it is a direct child, so that path behaves as before.

Tests: two regression tests added to tests/Languages/en/mtable.rs (matrix_raised_to_power, plus the exact MathML from the issue). No goldens changed. cargo test: 1982 + 5106 passed, 0 failed.

Both now read: the 2 by 2 matrix; row 1; 1, 2; row 2; 3, 4; squared. The commented-out Greek corpus cases mentioning "TEMP NAME του … πίνακας" (matrix inverse / powers) are likely the same defect.

🤖 Generated with Claude Code

https://claude.ai/code/session_01U86v5m1m8oaLSy5UsNbBpc

…a power is not read as "TEMP NAME of"

The mrow 'matrix' intent rule replaces with a bare `x: "*[2]"`, so its result is
wrapped in the internal TEMP_NAME transport element; the parent `power` rule's
`x: "*[1]"` wraps it again and lift_children only stripped one level. The
leftover wrapper reached the generic function-intent speech rule, which spoke
its name: "TEMP NAME of the 2 by 2 matrix; ...; squared" (daisy#762).

lift_children now flattens nested wrappers recursively. A leaf wrapper holding
text is still only unwrapped as a direct child, matching the previous behavior.
Two regression tests added to tests/Languages/en/mtable.rs; no goldens changed.

Fixes daisy#762

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U86v5m1m8oaLSy5UsNbBpc
@moritz-gross

Copy link
Copy Markdown
Collaborator

hi, thanks for your contribution.

I have not yet worked much with the intent tree, let alone TEMP_NAME, so it will take me a bit to read into this to review the PR.

not sure how busy @NSoiffer is at the moment ?

@NSoiffer

Copy link
Copy Markdown
Collaborator

@wittjeff: Thanks for the fix. It looks good.

I don't see "...the commented-out Greek corpus cases mentioning "TEMP NAME του … πίνακας" (matrix inverse / powers) are likely the same defect." Do you know where that is?

@NSoiffer
NSoiffer merged commit d5d1933 into daisy:main Sep 13, 2026
10 checks passed
@github-project-automation github-project-automation Bot moved this from Triage to Done in MathCAT Project Board Sep 13, 2026
@wittjeff

Copy link
Copy Markdown
Contributor Author

@NSoiffer Those aren't in active tests. They're in the "//theodora. fails. Now reads: …" notes in tests/Languages/el/uoa_corpus_Simplespeak.rs and uoa_corpus_Clearspeak.rs (uoa_corpus_217, 218, 224, 234) and tests/Languages/el/difficult_greek.rs (fourteen, twentyfive, and the commented-out test_matrix_after_operator_nominative2 / diagonal_matrix_frac_nominative). None of it runs: tests/languages.rs has no mod el; and el.rs comments out those modules.

I turned them back on and ran them. On main as of the commit before #763, the Greek tests print "TEMP NAME" 10 times; with #763 merged, 0. The Greek tests go from 801 to 806 passing, and five of the ten cases above now pass. The other five still fail, but only on wording: the expected strings want different articles/case (e.g. "τον 2 επί 2 πίνακα" vs "ο 2 επί 2 πίνακας"), which is unrelated to this bug. So nothing more is needed for TEMP_NAME. The "Now reads" notes are just out of date.

@wittjeff
wittjeff deleted the fix/762-nested-temp-name-wrapper branch September 16, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

NVDA pronounces the phrase "temp name" when matrix is raised to a power

3 participants