make highlight friendly to English (#2417)

### What problem does this PR solve?

#2415

### Type of change

- [x] Performance Improvement
This commit is contained in:
Kevin Hu
2024-09-13 17:03:51 +08:00
committed by GitHub
parent 5e7b93e802
commit 9d4bb5767c
3 changed files with 22 additions and 20 deletions

View File

@ -214,7 +214,7 @@ def is_english(texts):
eng = 0
if not texts: return False
for t in texts:
if re.match(r"[a-zA-Z]{2,}", t.strip()):
if re.match(r"[ `a-zA-Z.,':;/\"?<>!\(\)-]", t.strip()):
eng += 1
if eng / len(texts) > 0.8:
return True