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