1
0
Fork 0

Fix bug 553

Bug553_LinShan
林杉 2024-03-25 10:15:11 +08:00
parent f164465903
commit b8f2919959
1 changed files with 1 additions and 1 deletions

View File

@ -41,7 +41,7 @@ def file2str(fname):#文件转字符
def remove_punctuation(s): # 这里是s是形参 (parameter)。函数被调用时才给s赋值。
special_characters = '\_©~<=>+/[]*&$%^@.,?!:;#()"“”—‘’{}|,。?!¥……()、《》:;·' # 把里面的字符都去掉
s = html.unescape(s)
s = html.unescape(s) # 将HTML实体转换为对应的字符比如<会被识别为小于号
for c in special_characters:
s = s.replace(c, ' ') # 防止出现把 apple,apple 移掉逗号后变成 appleapple 情况
s = s.replace('--', ' ')