def best_match(word, corrected_med_list, corrected_english_list):
min_dist_med = len(word)
best_med_word = ''
min_dist_eng = len(word)
best_eng_word = ''
for word_t in corrected_med_list:
if editdistance.eval(word, word_t) < min_dist_med:
min_dist_med = editdistance.eval(word, word_t)
best_med_word = word_t
for word_t in corrected_english_list:
if editdistance.eval(word, word_t) < min_dist_eng:
min_dist_eng = editdistance.eval(word, word_t)
best_eng_word = word_t
if min_dist_med <= min_dist_eng:
return best_med_word
else:
return best_eng_word
correct_item_descriptions.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录