Fix bug 533

Bug533-Yuyikai
余忆开 2024-05-29 10:29:35 +08:00
parent fab04aae1d
commit d6f4c247ea
3 changed files with 3 additions and 3 deletions

View File

@ -29,7 +29,7 @@ path_prefix = './' # comment this line in deployment
def load_word_list(csv_file): 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) reader = csv.reader(f)
return set(word.strip().lower() for row in reader for word in row[0].split(',')) return set(word.strip().lower() for row in reader for word in row[0].split(','))
@ -96,8 +96,8 @@ def mainpage():
:return: 主界面 :return: 主界面
''' '''
db_file = "../db/wordfreqapp.db" db_file = "db\wordfreqapp.db"
csv_file = "../db/The_Oxford.csv" csv_file = "db\The_Oxford.csv"
text_list = load_text_list_from_db(db_file) text_list = load_text_list_from_db(db_file)
word_set = load_word_list(csv_file) word_set = load_word_list(csv_file)
coverage_percentage = "{:.2f}".format(calculate_coverage(text_list, word_set)) coverage_percentage = "{:.2f}".format(calculate_coverage(text_list, word_set))

View File

0
identifier.sqlite Normal file
View File