seatgeek / fuzzywuzzy

Fuzzy String Matching in Python
http://chairnerd.seatgeek.com/fuzzywuzzy-fuzzy-string-matching-in-python/
GNU General Public License v2.0
9.21k stars 874 forks source link

Partial match on Python3 doesn't work if Levenshtein module is present #63

Closed ojomio closed 9 years ago

ojomio commented 9 years ago
Traceback (most recent call last):
  File "./test_fuzzywuzzy.py", line 199, in testWRatioUnicodeString
    score = fuzz.WRatio(s1, s2, force_ascii=False)
  File "/tmp/pyphrasy/fuzzywuzzy/fuzzywuzzy/fuzz.py", line 255, in WRatio
    partial = partial_ratio(p1, p2) * partial_scale
  File "/tmp/pyphrasy/fuzzywuzzy/fuzzywuzzy/fuzz.py", line 77, in partial_ratio
    blocks = m.get_matching_blocks()
  File "/tmp/pyphrasy/fuzzywuzzy/fuzzywuzzy/StringMatcher.py", line 57, in get_matching_blocks
    self._str1, self._str2)
TypeError: inverse expected a list of edit operations
josegonzalez commented 9 years ago

Mind making a PR? Interesting that the api changed...

ojomio commented 9 years ago

I do need this fix but not sure how the API changed.. I've never written python extensions with ctypes before. But if I had someone to discuss it in real time (over whatsapp or skype, or xmpp, etc) I might try to help

josegonzalez commented 9 years ago

I'm unfortunately not familiar with it - I'm mostly triaging issues and ensuring the repo gets maintained - though I'll try and take a look at it later this week. I'm on freenode as savant if you want to talk there.

ojomio commented 9 years ago

OK, I think I'll try to open an issue in https://github.com/ztane/python-Levenshtein

ojomio commented 9 years ago

Good news: I managed to get Levenshtein to work! https://github.com/ojomio/python-Levenshtein But I'm unsure of whether I've done it properly or not :( The issue was with bytes and unicode, as you can imagine. I needed to learn CTypes a bit)

josegonzalez commented 9 years ago

I think you made the PR to @ztane's repository, so closing since this is fixed :)