Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Possible bug in partial_ratio #15

wants to merge 4 commits into


None yet
3 participants

medecau commented Sep 17, 2012

Tests show what I believe to be the bug

For now I am reluctant in writing a patch as I don't fully understand what is the expected behavior for partial_ratio.


acslater00 commented Sep 17, 2012

I believe this is not a bug. Given s1 and s2 where len(s1) > len(s2), partial ratio finds the fuzz.ratio(sub_s1, s2) for each possible substring sub_s1 of s1 such that len(sub_s1) = len(s2). In other words, in your example it's finding the best substring of "a1" and "b1" that is 6 chars long, and then returning that ratio.

To my eye, it looks like the best matches are

123 45
12 456  
fuzz.ratio("123 45", "12 456") => 83

456 78
456 90
fuzz.ratio("456 78", "456 90") => 66

So this looks correct to me.


josegonzalez commented Oct 30, 2013

@acslater00 should we merge or kill this?


medecau commented Oct 30, 2013

I'm ok with killing it.


medecau commented May 30, 2014

This should be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment