简体   繁体   中英

Fuzzy Wuzzy to match names

I am trying to match names with a list of names

text_to_match = "sa"
print(process.extract(text_to_match, ['sachin','saurabh','Amol'],scorer=fuzz.WRatio))

The results I got are as below

[('sachin', 90), ('saurabh', 90), ('Amol', 33)]

However i was expecting that since sa matched only with only partial letters of sachin it should have given a much smaller score but it gave a very high result.

What can I do to get better results as per requirement?

If you want the scoring to be more strict, instead of using fuzz.WRatio , you can just use fuzz.ratio .

text_to_match = "sa"
print(process.extract(text_to_match, ['sachin','saurabh','Amol'],scorer=fuzz.ratio))

Assuming your requirement is that partial matches should not get a high score, this change should help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM