更新了detectmaxsim功能,稍有加速, 需要调用处理过的字典

This commit is contained in:
weiye.wang 2023-07-08 17:18:42 +08:00
parent a5c4a697c7
commit e7f5637231
1 changed files with 1 additions and 2 deletions

View File

@ -60,10 +60,9 @@ def treat_dict(p_dict): #对整个题库字典中的内容部分进行预处理
def detectmaxsim(currentid,excludelist,adict): #检测与已知题目关联程度最大的题目(除外列表之外的部分)
maxsim = -1
argmaxsim = "000000"
treated_dict = treat_dict(adict)
for id in adict:
if not id in excludelist:
simrate = Levenshtein.jaro(treat_dict[id]["content"],treat_dict[currentid]["content"])
simrate = Levenshtein.jaro(adict[id]["content"],adict[currentid]["content"])
if simrate > maxsim:
maxsim = simrate
argmaxsim = id