forked from mrlan/EnglishPal
				
			Fix bug 533
							parent
							
								
									fab04aae1d
								
							
						
					
					
						commit
						d6f4c247ea
					
				|  | @ -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)) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue