Skip to content

Implement equation extraction (font/Unicode detection + required batched Engine call) - #2

Open
lorenzoliuzzo wants to merge 1 commit into
mainfrom
feat/build-tool
Open

Implement equation extraction (font/Unicode detection + required batched Engine call)#2
lorenzoliuzzo wants to merge 1 commit into
mainfrom
feat/build-tool

Conversation

@lorenzoliuzzo

Copy link
Copy Markdown
Contributor

Builds the tool out from the pristine my-template stub to parity with my-figure.

  • extract.py: PyMuPDF-based region detection via math-font family (CM*/Symbol) or Greek/math-Unicode character ratio, clustering adjacent flagged lines into multi-line equations, cropped to images.
  • tool.py: real LEDGER_KIND=equation_extract; every region is batched into one required Engine call per document (no deterministic math-to-LaTeX path exists), producing LaTeX + per-symbol meanings grounded in nearby prose; ungrounded symbols stay "". Writes equations/<doc-id>/{crops, index.json, README.md}.
  • Tests: 20 passing, 95% coverage.

Part of finishing MyFigure/MyTables/MyEquations to parity before wiring any of them into MyTypster.

…d batched Engine call, Workspace PR

Flags math-typeset regions by font family (CM*/Symbol) or Greek/math-Unicode
character ratio, clusters adjacent flagged lines into multi-line equations,
and crops each to an image. Every detected region is batched into one
required Engine call per document -- there is no deterministic math-to-LaTeX
path -- transcribing to LaTeX and grounding each symbol's meaning in nearby
prose, with an ungrounded symbol staying "" rather than invented. Writes
region crops + index.json + a rendered README per document.
@lorenzoliuzzo
lorenzoliuzzo marked this pull request as ready for review July 12, 2026 20:23
@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.79769% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/myequations/extract.py 92.20% 6 Missing ⚠️
src/myequations/tool.py 96.87% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant