def similarity(n1, n2):
"""
Returns the mean of the partial_ratio score for each field in the two
entities. Note that if they don't have fields that match, the score will
be zero.
"""
scores = [
fuzz.partial_ratio(n1, n2)
]
return float(sum(s for s in scores)) / float(len(scores))
评论列表
文章目录