Skip to content

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

feat: improve label filtering logic in formula prediction

myhloli9c917c33e1f3
diff --git a/mineru/model/mfr/pp_formulanet_plus_m/predict_formula.py b/mineru/model/mfr/pp_formulanet_plus_m/predict_formula.py
index 81869d67..6582d4ba 100644
--- a/mineru/model/mfr/pp_formulanet_plus_m/predict_formula.py
+++ b/mineru/model/mfr/pp_formulanet_plus_m/predict_formula.py
@@ -96,7 +96,10 @@ class FormulaRecognizer(BaseOCRV20):
for item in mfd_res or []:
if not isinstance(item, dict):
continue
- if item.get("label") not in ["inline_formula", "display_formula"]:
+ label = item.get("label")
+ if label not in ["inline_formula", "display_formula"]:
+ continue
+ if not interline_enable and label == "display_formula":
continue
new_item = dict(item)
diff --git a/mineru/model/mfr/unimernet/Unimernet.py b/mineru/model/mfr/unimernet/Unimernet.py
index c442cad6..386b3c54 100644
--- a/mineru/model/mfr/unimernet/Unimernet.py
+++ b/mineru/model/mfr/unimernet/Unimernet.py
@@ -63,7 +63,10 @@ class UnimernetModel(object):
for item in mfd_res or []:
if not isinstance(item, dict):
continue
- if item.get("label") not in ["inline_formula", "display_formula"]:
+ label = item.get("label")
+ if label not in ["inline_formula", "display_formula"]:
+ continue
+ if not interline_enable and label == "display_formula":
continue
new_item = dict(item)