Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

fix(pre_proc): add Discarded block type to span block type compatibility

myhloli7a8568045d8f
diff --git a/magic_pdf/pre_proc/ocr_dict_merge.py b/magic_pdf/pre_proc/ocr_dict_merge.py
index 5e476a4e..38ca3652 100644
--- a/magic_pdf/pre_proc/ocr_dict_merge.py
+++ b/magic_pdf/pre_proc/ocr_dict_merge.py
@@ -62,7 +62,15 @@ def merge_spans_to_line(spans, threshold=0.6):
def span_block_type_compatible(span_type, block_type):
if span_type in [ContentType.Text, ContentType.InlineEquation]:
- return block_type in [BlockType.Text, BlockType.Title, BlockType.ImageCaption, BlockType.ImageFootnote, BlockType.TableCaption, BlockType.TableFootnote]
+ return block_type in [
+ BlockType.Text,
+ BlockType.Title,
+ BlockType.ImageCaption,
+ BlockType.ImageFootnote,
+ BlockType.TableCaption,
+ BlockType.TableFootnote,
+ BlockType.Discarded
+ ]
elif span_type == ContentType.InterlineEquation:
return block_type in [BlockType.InterlineEquation, BlockType.Text]
elif span_type == ContentType.Image: