Fix "TEMP NAME of" when a parenthesized matrix is raised to a power (#762) - #763
Conversation
…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
|
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 ? |
|
@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 Those aren't in active tests. They're in the "//theodora. fails. Now reads: …" notes in 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. |
Fixes #762.
A parenthesized matrix as the base of
msupwas spoken as "TEMP NAME of the 2 by 2 matrix; row 1; 1, 2; row 2; 3, 4; squared". The LuaLaTeXmspace/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_NAMEis the internal transport wrapperreplace_nodes_treeputs around a barex:replacement. The mrowmatrixintent rule replaces withx: "*[2]"(not anintent:), so the mrow's result isTEMP_NAME(matrix); thepowerrule'sx: "*[1]"wraps it again, andlift_childrenonly stripped one level. The leftover wrapper then reaches the generic function-intent speech rule, which speaks its name.Change:
lift_childreninsrc/speech.rsnow 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