更新了detectmaxsim功能,稍有加速, 需要调用处理过的字典
This commit is contained in:
parent
a5c4a697c7
commit
e7f5637231
|
|
@ -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
|
||||
|
|
|
|||
Reference in New Issue