From d6f4c247ea99b892c5f379c88b9d7d1df22fd72a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E5=BF=86=E5=BC=80?= <余忆开@2291723778@qq.com> Date: Wed, 29 May 2024 10:29:35 +0800 Subject: [PATCH] Fix bug 533 --- app/main.py | 6 +++--- app/static/wordfreqapp.db | 0 identifier.sqlite | 0 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 app/static/wordfreqapp.db create mode 100644 identifier.sqlite diff --git a/app/main.py b/app/main.py index 145bf7e..56bd0c3 100644 --- a/app/main.py +++ b/app/main.py @@ -29,7 +29,7 @@ path_prefix = './' # comment this line in deployment def load_word_list(csv_file): - with open(csv_file, 'r') as f: + with open(csv_file, 'r', encoding='utf-8') as f: # 添加encoding参数指定编码方式 reader = csv.reader(f) return set(word.strip().lower() for row in reader for word in row[0].split(',')) @@ -96,8 +96,8 @@ def mainpage(): :return: 主界面 ''' - db_file = "../db/wordfreqapp.db" - csv_file = "../db/The_Oxford.csv" + db_file = "db\wordfreqapp.db" + csv_file = "db\The_Oxford.csv" text_list = load_text_list_from_db(db_file) word_set = load_word_list(csv_file) coverage_percentage = "{:.2f}".format(calculate_coverage(text_list, word_set)) diff --git a/app/static/wordfreqapp.db b/app/static/wordfreqapp.db new file mode 100644 index 0000000..e69de29 diff --git a/identifier.sqlite b/identifier.sqlite new file mode 100644 index 0000000..e69de29