Skip to content

Commit 18e013f

Browse files
authored
Check if bounding box available before read values (#63)
* Check if bounding box available before read values * Fix styling --------- Co-authored-by: avvertix <5672748+avvertix@users.noreply.github.com>
1 parent 948c292 commit 18e013f

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/parxy_core/drivers/llamaparse.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,16 @@ def _convert_text_block(text_block: PageItem, page_number: int) -> TextBlock:
482482
TextBlock
483483
The converted `TextBlock` object.
484484
"""
485-
bbox = BoundingBox(
486-
x0=text_block.bBox.x,
487-
y0=text_block.bBox.y,
488-
x1=text_block.bBox.x + text_block.bBox.w,
489-
y1=text_block.bBox.y + text_block.bBox.h,
485+
## Note: Bounding Box (bBox) can be None, it is still to be evaluated if that is a sign of hallucination or not
486+
bbox = (
487+
BoundingBox(
488+
x0=text_block.bBox.x,
489+
y0=text_block.bBox.y,
490+
x1=text_block.bBox.x + text_block.bBox.w,
491+
y1=text_block.bBox.y + text_block.bBox.h,
492+
)
493+
if text_block.bBox is not None
494+
else None
490495
)
491496
# Handle empty page marker
492497
text_value = text_block.value if text_block.value else ''

0 commit comments

Comments
 (0)