Skip to content

Instantly share code, notes, and snippets.

@fjavieralba
Created January 25, 2013 11:50
Show Gist options
  • Save fjavieralba/4633857 to your computer and use it in GitHub Desktop.
Save fjavieralba/4633857 to your computer and use it in GitHub Desktop.
A simple but maybe useful distance definition for texts
from difflib import SequenceMatcher
def distance(url1, url2):
ratio = SequenceMatcher(None, url1, url2).ratio()
return 1.0 - ratio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment