From 62dd580974a282ede8f51c2c8ee44e53b31172d7 Mon Sep 17 00:00:00 2001 From: Lan Hui <1348141770@qq.com> Date: Wed, 28 Aug 2024 08:08:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E5=8A=A0=E5=85=A5=E7=94=9F=E8=AF=8D?= =?UTF-8?q?=E7=B0=BF=E5=89=8D=EF=BC=8C=E5=8E=BB=E6=8E=89=E5=85=A8=E8=A7=92?= =?UTF-8?q?=E6=96=B9=E6=8B=AC=E5=8F=B7=E3=80=90=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/wordfreqCMD.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/wordfreqCMD.py b/app/wordfreqCMD.py index f127dda..fb11a89 100644 --- a/app/wordfreqCMD.py +++ b/app/wordfreqCMD.py @@ -66,7 +66,7 @@ def file2str(fname):#文件转字符 def remove_punctuation(s): # 这里是s是形参 (parameter)。函数被调用时才给s赋值。 - special_characters = '\_©~<=>+/[]*&$%^@.,?!:;#()"“”—‘’{}|,。?!¥……()、《》:;·' # 把里面的字符都去掉 + special_characters = '\_©~<=>+/[]*&$%^@.,?!:;#()"“”—‘’{}|,。?!¥……()、《》【】:;·' # 把里面的字符都去掉 s = html.unescape(s) # 将HTML实体转换为对应的字符,比如<会被识别为小于号 for c in special_characters: s = s.replace(c, ' ') # 防止出现把 apple,apple 移掉逗号后变成 appleapple 情况