Skip to content

Instantly share code, notes, and snippets.

@soobrosa
Created April 11, 2012 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soobrosa/2359273 to your computer and use it in GitHub Desktop.
Save soobrosa/2359273 to your computer and use it in GitHub Desktop.
difflib chunk
import difflib
def neighbours(table, entry):
neighbour_list = difflib.get_close_matches(entry, table)
returns = {}
for neighbour in neighbour_list:
returns[neighbour] = difflib.SequenceMatcher(None, entry, neighbour).ratio()
return returns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment