Explorar el Código

fix: remove trailing backslashes from strings in modeling_unimernet.py

myhloli hace 5 meses
padre
commit
a392f445e8
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  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