소스 검색

fix clean text bug

zhangwei13 3 달 전
부모
커밋
dcd3256cc7
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      dots_ocr/utils/format_transformer.py

+ 2 - 1
dots_ocr/utils/format_transformer.py

@@ -136,7 +136,8 @@ def clean_text(text: str) -> str:
     text = text.strip()
     
     # Replace multiple consecutive whitespace characters with a single space
-    text = re.sub(r'\s+', ' ', text)
+    if text[:2] == '`$' and text[-2:] == '$`':
+        text = text[1:-1]
     
     return text