Created
April 11, 2012 13:24
-
-
Save soobrosa/2359273 to your computer and use it in GitHub Desktop.
difflib chunk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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