feat(chunking): repeat table headers on continuation chunks#4298
Open
feat(chunking): repeat table headers on continuation chunks#4298
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Behavior summary
Before
<thead>/<th>) were not retained as explicit row-level metadata after compactification.After
repeat_table_headers(defaultTrue) to chunking APIs and strategy plumbing:chunk_elements(..., repeat_table_headers=...)chunk_by_title(..., repeat_table_headers=...)add_chunking_strategy(...)forwarded args/docs_TableChunkernow detects contiguous leading header rows and repeats them on non-initial continuation chunks.text_as_html.Invariants
repeat_table_headers=False) matches legacy table splitting behavior.Edge cases covered
<thead>and<th>rows.partition_html(..., chunking_strategy="by_title").Test evidence
uv run --no-sync pytest -q test_unstructured/chunking/test_dispatch.py(6 passed)uv run --no-sync pytest -q test_unstructured/chunking/test_base.py -k "Describe_TableChunker"(26 passed)uv run --no-sync pytest -q test_unstructured/chunking/test_title.py::test_add_chunking_strategy_forwards_repeat_table_headers(1 passed)uv run --no-sync pytest -q test_unstructured/chunking/test_title.py -k "repeat_table_headers"(5 passed)uv run --with python-docx pytest -q test_unstructured/chunking/test_basic.py -k "repeat_table_headers"(4 passed)uv run --no-sync pytest -q test_unstructured/common/test_html_table.py(26 passed)authored by codex