seatgeek/fuzzywuzzy — Issue #7: Bug in partial_ratio
Author: rajkrpan
Created: 2011-12-19 08:15:23+00:00
State: open

There is a small bug in the partial_ratio

fuzz.partial_ratio('HSINCHUANG','Sinjhuang District'.upper()) = 30
whereas
fuzz.partial_ratio('HSINCHUANG','SINJHUAN) = 88
and
fuzz.partial_ratio('HSINCHUANG', 'LSINJHUANG DISTRIC')

Thus the function is unable to match the partial string of 'HSINCHUANG' and 'SINJHUANG DISTRIC'

if you substitute line
long_start = block[1] - block[0]
by
long_start = block[1] - block[0] if (block[1]-block[0])>0 else 0