From 576adab067a090776876a4ef69fc850b442a4b75 Mon Sep 17 00:00:00 2001 From: Gee Law Date: Mon, 25 Mar 2024 23:38:21 -0700 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=A4=E4=B8=AA=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 匹配非英文语段的错误,例如把“你好你好”转换为“你2好” 2. 匹配已经转换过的单词的错误,例如把“i18n”转换为“i2n” 该修复没有考虑带变音符号的拉丁字母等情况 --- i7h.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i7h.py b/i7h.py index 0f42293..2b9501e 100644 --- a/i7h.py +++ b/i7h.py @@ -9,5 +9,5 @@ def _f(r): def i18n(s: str) -> str: - s = re.sub(r'\w+', _f, s) + s = re.sub('[A-Za-z]+', _f, s) return s