docling icon indicating copy to clipboard operation
docling copied to clipboard

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

Open Raphilanthrope opened this issue 1 year ago • 1 comments

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 :)

Raphilanthrope avatar Nov 18 '24 10:11 Raphilanthrope

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

PeterStaar-IBM avatar Nov 18 '24 14:11 PeterStaar-IBM

@Raphilanthrope This is obsolete since docling 2.13.0 because the layout_utils code is entirely replaced.

cau-git avatar Dec 18 '24 11:12 cau-git