From 04c4064c68a04954c541bf122bcd913fd23ff2da Mon Sep 17 00:00:00 2001 From: 03 <1930154319@qq.com> Date: Mon, 18 Mar 2024 13:21:46 +0800 Subject: [PATCH] Fix bug 553 --- app/templates/mainpage_post.html | 2 +- app/wordfreqCMD.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/templates/mainpage_post.html b/app/templates/mainpage_post.html index 7357457..5df7dd5 100644 --- a/app/templates/mainpage_post.html +++ b/app/templates/mainpage_post.html @@ -2,7 +2,7 @@ - Title + 单词词频 {{ yml['header'] | safe }} {% if yml['css']['item'] %} diff --git a/app/wordfreqCMD.py b/app/wordfreqCMD.py index dcee74e..dfdde2e 100644 --- a/app/wordfreqCMD.py +++ b/app/wordfreqCMD.py @@ -4,6 +4,7 @@ ########################################################################### import collections +import html import string import operator import os, sys # 引入模块sys,因为我要用里面的sys.argv列表中的信息来读取命令行参数。 @@ -39,7 +40,8 @@ def file2str(fname):#文件转字符 def remove_punctuation(s): # 这里是s是形参 (parameter)。函数被调用时才给s赋值。 - special_characters = '\_©~<=>+/[]*&$%^@.,?!:;#()"“”—‘’{}|' # 把里面的字符都去掉 + special_characters = '\_©~<=>+/[]*&$%^@.,?!:;#()"“”—‘’{}|,。?!¥……()、《》:;·' # 把里面的字符都去掉 + s = html.unescape(s) for c in special_characters: s = s.replace(c, ' ') # 防止出现把 apple,apple 移掉逗号后变成 appleapple 情况 s = s.replace('--', ' ')