DS4SD / docling

Get your documents ready for gen AI
https://ds4sd.github.io/docling
MIT License
10.48k stars 507 forks source link

Should the second "if" keyword in adapt_bbox from layout_utils.py rather be an "elif" keyword ? #362

Open Raphilanthrope opened 4 days ago

Raphilanthrope commented 4 days ago

Question

I think I identified a typo based on a comment and the logic of the code itself.

In "adapt_bbox" from "layout_utils.py", there are three lines at the first function indentation level: if not (cluster["type"] in [DocItemLabel.TABLE, DocItemLabel.PICTURE]):; if cluster["type"] == DocItemLabel.PICTURE: and else: ## A table

Based on the comment ## A table and the fact that there is to my understanding other classes that TABLE and PICTURES leading to a re-definition of new_bbox in the else statement when handling a cluster's class different from a table and a picture, I think the second if is meant to be an elif keyword., i.e. we would write: elif cluster["type"] == DocItemLabel.PICTURE:

Am I right ?

Thank you for this great tool by the way :)

PeterStaar-IBM commented 4 days ago

@Raphilanthrope Make a quick PR with the fix, this could indeed be a bug.