-1

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?

Gupta
  • 314
  • 4
  • 17

1 Answers1

0

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.

angryweasel
  • 316
  • 2
  • 10