def match_elements(self, text1, text2):
"""
utility function to match two strings, makes use of
match config initiated in __init__
returns the output as confidence score of flexible match
"""
conf = 0
if self.m_config['exact']:
if text1 == text2:
conf += 1
if self.m_config['levenshtein']:
conf += ratio(text1, text2)
if self.m_config['soundex']:
if soundex(text1) == soundex(text2):
conf += 1
if self.m_config['nysiis']:
if fuzzy.nysiis(text1) == fuzzy.nysiis(text2):
conf += 1
return conf
评论列表
文章目录