Equations with a long left side lose everything after "=" #2

Open
opened 2026-11-27 00:33:45 +02:00 by paultal · 0 comments
Owner

Equations whose left side is longer than a token or two come back with everything after = missing.

input output
x squared plus y squared equals r squared x^2 + y^2
x squared plus y squared equals z x^2 + y^2
alpha squared plus beta squared equals gamma squared alpha^2 + beta^2
sine squared of x plus cosine squared of x equals 1 sin(x)^2 + cos(x)^2

All phrasings ("equals", "is equal to", "=") fail the same way. a squared plus b squared equals c squared happens to work.

Cause: TreeGen.tree() in src/isotope_typst/generate.py only builds Eq with a left side of y, f, x or expr(depth 0 or 1). Add(Pow, Pow) is depth 2, so it never shows up as a left side. There are zero training rows starting with x^2 + y^2.

Fix:

  • Let the left side be deeper (e.g. depth 0–3), keeping the overall length limit.
  • Add the four sentences above to eval/hand_test.jsonl (two of them are already there and failing).
Equations whose left side is longer than a token or two come back with everything after `=` missing. | input | output | |---|---| | x squared plus y squared equals r squared | `x^2 + y^2` | | x squared plus y squared equals z | `x^2 + y^2` | | alpha squared plus beta squared equals gamma squared | `alpha^2 + beta^2` | | sine squared of x plus cosine squared of x equals 1 | `sin(x)^2 + cos(x)^2` | All phrasings ("equals", "is equal to", "=") fail the same way. `a squared plus b squared equals c squared` happens to work. **Cause:** `TreeGen.tree()` in `src/isotope_typst/generate.py` only builds `Eq` with a left side of `y`, `f`, `x` or `expr(depth 0 or 1)`. `Add(Pow, Pow)` is depth 2, so it never shows up as a left side. There are zero training rows starting with `x^2 + y^2`. **Fix:** - Let the left side be deeper (e.g. depth 0–3), keeping the overall length limit. - Add the four sentences above to `eval/hand_test.jsonl` (two of them are already there and failing).
paultal added the P1 highbugdata labels 2026-11-27 00:33:45 +02:00
Sign in to join this conversation.