Skip to content

feat: label studio to DoclingDocument transform - #11

Open
cau-git wants to merge 2 commits into
mainfrom
cau/labelstudio-to-docling-improvements
Open

feat: label studio to DoclingDocument transform#11
cau-git wants to merge 2 commits into
mainfrom
cau/labelstudio-to-docling-improvements

Conversation

@cau-git

@cau-git cau-git commented Apr 2, 2026

Copy link
Copy Markdown
Member

Adds a complete toolbox to translate label-studio JSON into DoclingDocument format.

cau-git added 2 commits April 2, 2026 15:04
Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
…n contract

Replace the three highest-value geometric heuristics in the Label Studio →
DoclingDocument pipeline with explicit annotation-driven lookups:

H1 (parent resolution via containment tree):
- Build `children_by_parent` dict from `parent_ls_id` on rectangle regions
- `_determine_parent` and `_has_unresolved_parent` become direct dict lookups
- Remove `build_containment_tree`, `ls_element_to_cvat_element`, `_find_tree_node`,
  `containment_tree`/`tree_index` fields, and CVATElement/TreeNode imports

H2 (table structure discovery via bbox containment):
- `_create_table` uses `children_by_parent.get(element.ls_id)` instead of tree walk
- Table structure elements still consumed geometrically by `compute_cells` (unchanged)

H4 (list boundary detection via level comparison):
- `should_terminate_list`: remove level-based fallback — group path is the only
  boundary signal; element outside active group terminates the list
- `shtart_list`: remove level-comparison block; warn on list_item with no group

H1 reading order (child paths):
- `build_global_reading_order` restructured with DFS splice: child paths
  (polyline `level > 1`) are spliced immediately after their parent element
- Validation warnings for mismatched parent_ls_id and level/path-type mismatches

H5 (_process_remaining_children) simplifies naturally:
- Elements with no `parent_ls_id` absent from reading order are dropped with a warning
  instead of silently added at root

Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

DCO Check Passed

Thanks @cau-git, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Apr 2, 2026

Copy link
Copy Markdown

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

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