Skip to content

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

fix: keyerror in equation replace

许瑞92f9df5dd7f1
diff --git a/magic_pdf/pre_proc/equations_replace.py b/magic_pdf/pre_proc/equations_replace.py
index 394b56c0..70965615 100644
--- a/magic_pdf/pre_proc/equations_replace.py
+++ b/magic_pdf/pre_proc/equations_replace.py
@@ -258,6 +258,9 @@ def replace_line_v2(eqinfo, line):
last_overlap_span = -1
delete_chars = []
for i in range(0, len(line["spans"])):
+ if "chars" not in line["spans"][i]:
+ continue
+
if line["spans"][i].get("_type", None) is not None:
continue # 忽略,因为已经是插入的伪造span公式了