Skip to content

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

Open
wittjeff wants to merge 1 commit into
daisy:mainfrom
wittjeff:fix/762-nested-temp-name-wrapper
Open

Fix "TEMP NAME of" when a parenthesized matrix is raised to a power (#762)#763
wittjeff wants to merge 1 commit into
daisy:mainfrom
wittjeff:fix/762-nested-temp-name-wrapper

Conversation

@wittjeff

Copy link
Copy Markdown

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 ?

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.

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

2 participants