fuzzy-comparison
Fuzzy Regular Expressions
I found the TRE library, which seems to be able to do exactly fuzzy matching of regular expressions. Example: http://hackerboss.com/approximate-regex-matching-in-python/ It only supports insertion, deletion and substitution though. No transposition. But I guess that works ok. I tried the accompanying agrep tool with the regexp on the following file: TV Schedule for 10Jan TVSchedule for … Read more
Fuzzy String Comparison
There is a package called fuzzywuzzy. Install via pip: pip install fuzzywuzzy Simple usage: >>> from fuzzywuzzy import fuzz >>> fuzz.ratio(“this is a test”, “this is a test!”) 96 The package is built on top of difflib. Why not just use that, you ask? Apart from being a bit simpler, it has a number of … Read more
Good Python modules for fuzzy string comparison? [closed]
difflib can do it. Example from the docs: >>> get_close_matches(‘appel’, [‘ape’, ‘apple’, ‘peach’, ‘puppy’]) [‘apple’, ‘ape’] >>> import keyword >>> get_close_matches(‘wheel’, keyword.kwlist) [‘while’] >>> get_close_matches(‘apple’, keyword.kwlist) [] >>> get_close_matches(‘accept’, keyword.kwlist) [‘except’] Check it out. It has other functions that can help you build something custom.