Repository navigation
fix(otsl): keep cells when an unclosed cell precedes a closed one - #4916
dolfim-ibm merged 1 commit into
Conversation
A closed-tag match ran non-greedily to the first matching closing tag, so <fcel>a<fcel>b<nl><fcel>c</fcel> was read as one cell whose text was 'a<fcel>b<nl><fcel>c', dropping a row and two cells. Closed-tag text now stops at any OTSL token. Signed-off-by: kevin9327 <[email protected]>
|
✅ DCO Check Passed Thanks @kevin9327, all your commits are properly signed off. 🎉 |
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
AI triage (advisory)Checked commit The PR changes the closed-tag pattern in Topic labels added: CI safety: no concern found. A maintainer must still approve CI. The |
There was a problem hiding this comment.
AI first review (advisory): no blocker found
This review covers the full diff at 9485ceb1db. It read the code and did not run it.
I found no defect. The closed-tag branch now stops at any OTSL token, so an unclosed cell before a closed one no longer merges cells. Fully closed and fully unclosed output parses as before.
A maintainer makes the merge decision. This review never approves the pull request.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
parse_otsl_output(used by the Granite Vision table-structure stage and the MinerU helper) accepts both closed cells (<fcel>x</fcel>) and unclosed ones (<fcel>x<fcel>y<nl>). When an unclosed cell came before a closed cell of the same tag, the closed-tag branch matched first. Its non-greedy.*?then ran to the first</fcel>and swallowed the tokens in between:With the fix, closed-tag text cannot contain another OTSL token, so the unclosed-cell branch handles those cells instead. Output that is fully closed or fully unclosed parses the same as before.
Checklist:
Review evidence:
tests/test_otsl_utils.py::test_closed_cell_does_not_swallow_preceding_open_cellsfails onmainand passes with the fix. The second test checks that fully closed output is unchanged.parse_otsl_outputtests intests/test_table_structure_granite_vision.py(-k parse, 13 tests) against the fix with the model imports stubbed out, since I did not install the ML extras, and they all pass. I did not run the full suite.ruff format --checkandruff checkpass on the changed files.AI assistance: I used an AI coding assistant (Grok Bot) to help find and write this fix. I reviewed the change and ran the tests above myself.