From 9e3664421558a14486d75490a99bbb533f8b2e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=B9=B8?= <2567198082@qq.com> Date: Tue, 14 Jun 2022 15:56:12 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E4=B8=8A=E4=B8=80=E7=AF=87=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/templates/userpage_get.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index 19542c1..253b544 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -27,8 +27,12 @@ 重设密码

{{ flashed_messages|safe }} + {% if session.get('articleID') != session.get('temp') %} + {% if session.get('artcleID') != Null %} +

上一篇 Previous Article + {% endif%} + {% endif %} 下一篇 Next Article -

下一篇 Next Article

阅读文章并回答问题

{{ today_article|safe }}
-- 2.17.1 From 22775f979747e13b325bde2dbbbf62888240d9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=B9=B8?= <2567198082@qq.com> Date: Tue, 14 Jun 2022 15:58:21 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=87=B3=20'app'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/user_service.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/app/user_service.py b/app/user_service.py index 139c140..4e485f1 100644 --- a/app/user_service.py +++ b/app/user_service.py @@ -22,6 +22,20 @@ path_prefix = '/var/www/wordfreq/wordfreq/' path_prefix = './' # comment this line in deployment + +#@userService.route("//reset", methods=['GET', 'POST']) +#def user_reset(username): + #''' + #用户界面 + #:param username: 用户名 + #:return: 返回页面内容 + #''' +# if request.method == 'GET': +# session['articleID'] = None +# return redirect(url_for('user_bp.userpage', username=username)) +# else: +# return 'Under construction' + @userService.route("//reset", methods=['GET', 'POST']) def user_reset(username): ''' @@ -29,12 +43,25 @@ def user_reset(username): :param username: 用户名 :return: 返回页面内容 ''' + session['temp'] = session.get('articleID') if request.method == 'GET': session['articleID'] = None return redirect(url_for('user_bp.userpage', username=username)) else: return 'Under construction' +@userService.route("//back", methods=['GET']) +def user_back(username): + ''' + 用户界面 + :param username: 用户名 + :return: 返回页面内容 + ''' + if request.method == 'GET': + session['articleID'] = session.get('temp') + return redirect(url_for('user_bp.userpage', username=username)) + + @userService.route("///unfamiliar", methods=['GET', 'POST']) def unfamiliar(username, word): -- 2.17.1 From 71cc627aadbf101a52dd5a7693460709daa7a3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=B9=B8?= <2567198082@qq.com> Date: Wed, 15 Jun 2022 11:42:46 +0800 Subject: [PATCH 03/15] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'app/templates/userp?= =?UTF-8?q?age=5Fget.html'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/templates/userpage_get.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index 253b544..bf8379f 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -28,7 +28,7 @@

{{ flashed_messages|safe }} {% if session.get('articleID') != session.get('temp') %} - {% if session.get('artcleID') != Null %} + {% if session.get('temp') != None %}

上一篇 Previous Article {% endif%} {% endif %} 下一篇 Next Article -- 2.17.1 From e73c66edd3dc8d2dcbdfb8b2504a9d3e0fb6a882 Mon Sep 17 00:00:00 2001 From: Lan Hui <1348141770@qq.com> Date: Thu, 21 Jul 2022 22:12:35 +0800 Subject: [PATCH 04/15] Re-arrange button positions (put Next Article before Previous Article). --- app/templates/userpage_get.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index fea7b5b..9eecbd2 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -27,11 +27,13 @@ 重设密码

{{ flashed_messages|safe }} + + 下一篇 Next Article {% if session.get('articleID') != session.get('temp') %} {% if session.get('temp') != None %} -

上一篇 Previous Article + 上一篇 Previous Article {% endif%} - {% endif %} 下一篇 Next Article + {% endif %}

阅读文章并回答问题

{{ today_article|safe }}
-- 2.17.1 From 4513a80bddcbdf06fd19e92638b2fa4acdd4adb4 Mon Sep 17 00:00:00 2001 From: Lan Hui <1348141770@qq.com> Date: Thu, 21 Jul 2022 22:15:07 +0800 Subject: [PATCH 05/15] Remove unused code. --- app/user_service.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/app/user_service.py b/app/user_service.py index f9ecc58..f758f77 100644 --- a/app/user_service.py +++ b/app/user_service.py @@ -22,20 +22,6 @@ path_prefix = '/var/www/wordfreq/wordfreq/' path_prefix = './' # comment this line in deployment - -#@userService.route("//reset", methods=['GET', 'POST']) -#def user_reset(username): - #''' - #用户界面 - #:param username: 用户名 - #:return: 返回页面内容 - #''' -# if request.method == 'GET': -# session['articleID'] = None -# return redirect(url_for('user_bp.userpage', username=username)) -# else: -# return 'Under construction' - @userService.route("//reset", methods=['GET', 'POST']) def user_reset(username): ''' -- 2.17.1 From 2a553e0f8f91f6d0b3d625edbc2a45afb8da806f Mon Sep 17 00:00:00 2001 From: Lan Hui <1348141770@qq.com> Date: Thu, 21 Jul 2022 22:17:50 +0800 Subject: [PATCH 06/15] Use a better variable name. --- app/templates/userpage_get.html | 4 ++-- app/user_service.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index 9eecbd2..be503e6 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -29,8 +29,8 @@ {{ flashed_messages|safe }} 下一篇 Next Article - {% if session.get('articleID') != session.get('temp') %} - {% if session.get('temp') != None %} + {% if session.get('articleID') != session.get('old_articleID') %} + {% if session.get('old_articleID') != None %} 上一篇 Previous Article {% endif%} {% endif %} diff --git a/app/user_service.py b/app/user_service.py index f758f77..7ae608a 100644 --- a/app/user_service.py +++ b/app/user_service.py @@ -29,7 +29,7 @@ def user_reset(username): :param username: 用户名 :return: 返回页面内容 ''' - session['temp'] = session.get('articleID') + session['old_artcileID'] = session.get('articleID') if request.method == 'GET': session['articleID'] = None return redirect(url_for('user_bp.userpage', username=username)) @@ -44,7 +44,7 @@ def user_back(username): :return: 返回页面内容 ''' if request.method == 'GET': - session['articleID'] = session.get('temp') + session['articleID'] = session.get('old_artcileID') return redirect(url_for('user_bp.userpage', username=username)) -- 2.17.1 From 4fb1cad7457285da5a24ca152219df86a2447b57 Mon Sep 17 00:00:00 2001 From: Lan Hui <1348141770@qq.com> Date: Thu, 21 Jul 2022 22:28:22 +0800 Subject: [PATCH 07/15] Use a better variable name (fix session variable name error). --- app/user_service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/user_service.py b/app/user_service.py index 7ae608a..5148a60 100644 --- a/app/user_service.py +++ b/app/user_service.py @@ -29,7 +29,7 @@ def user_reset(username): :param username: 用户名 :return: 返回页面内容 ''' - session['old_artcileID'] = session.get('articleID') + session['old_articleID'] = session.get('articleID') if request.method == 'GET': session['articleID'] = None return redirect(url_for('user_bp.userpage', username=username)) @@ -44,7 +44,7 @@ def user_back(username): :return: 返回页面内容 ''' if request.method == 'GET': - session['articleID'] = session.get('old_artcileID') + session['articleID'] = session.get('old_articleID') return redirect(url_for('user_bp.userpage', username=username)) -- 2.17.1 From 68b254f96c23fdc1d3ae89fa9b4e05fb63676ebf Mon Sep 17 00:00:00 2001 From: dktea <1403056133@qq.com> Date: Sat, 10 Dec 2022 19:18:56 +0800 Subject: [PATCH 08/15] init me --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ec92598..c1310ba 100644 --- a/README.md +++ b/README.md @@ -180,5 +180,5 @@ Demo video link: https://b23.tv/QuB77m Bug report: http://118.25.96.118/bugzilla/show_bug.cgi?id=215 - +龚科丞 135 *Last modified on 2021-10-17* \ No newline at end of file -- 2.17.1 From 071d1c968b52469b40e603f063f54cdcb07c63f3 Mon Sep 17 00:00:00 2001 From: dktea <1403056133@qq.com> Date: Sat, 10 Dec 2022 19:40:54 +0800 Subject: [PATCH 09/15] init me again --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c1310ba..522638a 100644 --- a/README.md +++ b/README.md @@ -180,5 +180,5 @@ Demo video link: https://b23.tv/QuB77m Bug report: http://118.25.96.118/bugzilla/show_bug.cgi?id=215 -龚科丞 135 +龚科丞 *Last modified on 2021-10-17* \ No newline at end of file -- 2.17.1 From b9a6e4407ec024d8b597d67c053ee78e18f4c6a3 Mon Sep 17 00:00:00 2001 From: dktea <1403056133@qq.com> Date: Tue, 20 Dec 2022 12:19:06 +0800 Subject: [PATCH 10/15] Bug493-Fix --- app/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/main.py b/app/main.py index e311bb0..f293398 100644 --- a/app/main.py +++ b/app/main.py @@ -85,6 +85,10 @@ def mainpage(): content = escape(request.form['content']) f = WordFreq(content) lst = f.get_freq() + for i in lst: + if '&' in i[0]: + i[0].replace('&','\'') + #此处由于找不到输出的所以对其输入的格式进行重新规范 # save history d = load_freq_history(path_prefix + 'static/frequency/frequency.p') lst_history = pickle_idea.dict2lst(d) -- 2.17.1 From 61f46f7d58f78859256b0d911c88e3b6ec52a900 Mon Sep 17 00:00:00 2001 From: tianqilu <1336601986@qq.com> Date: Thu, 27 Apr 2023 15:43:11 +0800 Subject: [PATCH 11/15] first commit --- app/templates/userpage_get.html | 5 ++++- app/user_service.py | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index 9e3891b..120eeac 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -26,7 +26,10 @@ 退出 重设密码

- {{ flashed_messages|safe }} + {% if flashed_messages != "" %} + + {% endif %} + 下一篇 Next Article {% if session.get('articleID') != session.get('old_articleID') %} diff --git a/app/user_service.py b/app/user_service.py index 79c7888..72200c5 100644 --- a/app/user_service.py +++ b/app/user_service.py @@ -181,7 +181,5 @@ def get_flashed_messages_if_any(): messages = get_flashed_messages() s = '' for message in messages: - s += '' + s += message return s -- 2.17.1 From 705aa5efcbb2af912bb03e3d50a330a4e52ac229 Mon Sep 17 00:00:00 2001 From: tianqilu <1336601986@qq.com> Date: Thu, 27 Apr 2023 16:00:46 +0800 Subject: [PATCH 12/15] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9,=E5=89=8D=E9=9D=A2?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=9A=84first=20commit=E6=98=AF=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/wordfreqCMD.py | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/app/wordfreqCMD.py b/app/wordfreqCMD.py index 9ee7e56..8973064 100644 --- a/app/wordfreqCMD.py +++ b/app/wordfreqCMD.py @@ -38,20 +38,42 @@ def file2str(fname):#文件转字符 return s +def str2chararray(str): # 字符串转字符数组 + chararray = [] + for i in range(len(str)): + chararray.append(str[i]) + return chararray + + def remove_punctuation(s): # 这里是s是形参 (parameter)。函数被调用时才给s赋值。 - special_characters = '_©~=+[]*&$%^@.,?!:;#()"“”—‘’' # 把里面的字符都去掉 + # carr = str2chararray(s) # 字符串转字符数组 + # print(carr) + special_characters = '&_~=+[]%^@.,?!:;#()"“”—‘’|/\\<>{}' # 把里面的字符都去掉 + special_words = ('$lt', '$gt', '$') # 特殊词汇 for c in special_characters: - s = s.replace(c, ' ') # 防止出现把 apple,apple 移掉逗号后变成 appleapple 情况 + s = s.replace(c, ' ') # 防止出现把 apple,apple 移掉逗号后变成 appleapple 情况 + carr = str2chararray(s) # 字符串转字符数组 + for i, value in enumerate(carr): + if value == '&': # 遍历替换 + carr[i] = '\'' + print('sss' + s) + for j in range(1,5): + if carr[i+j] in [' ','3','9']: + carr[i + j]='' + s = ''.join(carr) # 字符数组转字符串 + print('sss'+s) + for w in special_words: # 替换字符串中的剩余特殊字符 + s = s.replace(w, ' ') s = s.replace('--', ' ') - s = s.strip() # 去除前后的空格 - + s = s.strip() # 去除前后的空格 + if '\'' in s: n = len(s) - t = '' # 用来收集我需要保留的字符 - for i in range(n): # 只有单引号前后都有英文字符,才保留 + t = '' # 用来收集我需要保留的字符 + for i in range(n): # 只有单引号前后都有英文字符,才保留 if s[i] == '\'': i_is_ok = i - 1 >= 0 and i + 1 < n - if i_is_ok and s[i-1] in string.ascii_letters and s[i+1] in string.ascii_letters: + if i_is_ok and s[i - 1] in string.ascii_letters and s[i + 1] in string.ascii_letters: t += s[i] else: t += s[i] @@ -60,6 +82,7 @@ def remove_punctuation(s): # 这里是s是形参 (parameter)。函数被调用 return s + def sort_in_descending_order(lst):# 单词按频率降序排列 lst2 = sorted(lst, reverse=True, key=lambda x: (x[1], x[0])) return lst2 -- 2.17.1 From a5c792b78275a88a9f2d5c80861c48bde3430722 Mon Sep 17 00:00:00 2001 From: tianqilu <1336601986@qq.com> Date: Sun, 14 May 2023 21:10:19 +0800 Subject: [PATCH 13/15] =?UTF-8?q?=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/templates/userpage_get.html | 12 ++++++------ app/user_service.py | 7 +++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index 6d43e36..0ee66dc 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -37,16 +37,16 @@

English Pal for {{ username }} -<<<<<<< HEAD 退出 重设密码

- {% if flashed_messages != "" %} - + {% if flashed_messages != [] %} + {% endif %} -======= ->>>>>>> d9f6df7fbe585395a19b9a08c411d841b6b89fd4 + {% if username == admin_name %} 管理 @@ -123,7 +123,7 @@ {% if d_len > 0 %}

- 我的生词簿 + 我的生词簿