7th_fix doc

This commit is contained in:
beabigegg
2025-09-03 19:00:29 +08:00
parent 086c4f25b9
commit 82aaa315bb
5 changed files with 629 additions and 12 deletions

View File

@@ -307,15 +307,11 @@ class ExcelParser(DocumentParser):
return None
def _should_translate(self, text: str, src_lang: str) -> bool:
"""判斷文字是否需要翻譯(修正中文長度判斷"""
"""判斷文字是否需要翻譯(只要有字就翻譯"""
text = text.strip()
# 檢查是否包含中日韓文字
has_cjk = self._has_cjk(text)
# 對於包含CJK字符的文字放寬長度限制為2個字符
min_length = 2 if has_cjk else 3
if len(text) < min_length:
# 只要有字就翻譯 - 最小長度設為1
if len(text) < 1:
return False
# Skip pure numbers, dates, etc.