瀏覽代碼

fix: remove trailing backslashes from strings in modeling_unimernet.py

myhloli 5 月之前
父節點
當前提交
a392f445e8
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      mineru/model/mfr/unimernet/unimernet_hf/modeling_unimernet.py

+ 4 - 0
mineru/model/mfr/unimernet/unimernet_hf/modeling_unimernet.py

@@ -374,6 +374,10 @@ def latex_rm_whitespace(s: str):
     # \qquad后补空格
     s = QQUAD_PATTERN.sub(r'\\qquad ', s)
 
+    # 如果字符串以反斜杠结尾,去掉最后的反斜杠
+    while s.endswith('\\'):
+        s = s[:-1]
+
     return s