Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FuzzyWuzzy String Matching - Case Sensitivity

I'm using the FuzzyWuzzy String Matching module from SeatGeek.

I find that when using the token_set_ratio search algorithm, small differences in case gives wildly differing results.

For example, if I am looking for the phrase "I am eating" in a file, I get a 100% match. But if the phrase is "i am eating", just the change in case of ONE letter, gives me a 65% match.

Is there any way to make the algorithm case insensitive?

like image 839
shoi Avatar asked Oct 20 '25 03:10

shoi


2 Answers

token_set_ratio() is case insensitive by default.

from fuzzywuzzy import fuzz
fuzz.token_set_ratio("I am eating", "i am eating")
=> 100
like image 149
acslater00 Avatar answered Oct 22 '25 03:10

acslater00


I had the same issue, you probably were using Ratio and not TokenSetRatio...

like image 22
Pieter Buitelaar Avatar answered Oct 22 '25 05:10

Pieter Buitelaar