John Henry wrote: > I am just wondering what's with get_close_matches() in difflib. What's > the magic? How fuzzy do I need to get in order to get a match?
Are you desperate to understand the inner workings of difflib, or do you want merely to do some fuzzy matching of strings using a well-known somewhat-more-understandable zillions-of-implementations metric? If the latter, google "Levenshtein distance" for the metric, and "Python Levenshtein" -- first hit for me is an implementation in a Python C-extension. If you don't have the ability to compile a C extension, or don't need the speed, there should be a few pure-Python versions around; I'm specifically aware of one by Magnus Lie Hetland. It's less than a screenful of code; good idea to grab it anyway for educational purposes -- a quite Pythonic implementation of the traditional algorithm. HTH, John -- http://mail.python.org/mailman/listinfo/python-list