Skip to content

Instantly share code, notes, and snippets.

@langner
Last active August 29, 2015 14:05
Show Gist options
  • Save langner/08164c88bb37cb18b6d1 to your computer and use it in GitHub Desktop.
Save langner/08164c88bb37cb18b6d1 to your computer and use it in GitHub Desktop.
Python function for testing similarity of two DOIs
def similar_dois(d1, d2, accuracy=1.00):
"""Determine whether DOIs are similar.
DOIs basically need to be identical, but are case insensitive.
"""
if not (d1 and d2):
return False
d1 = d1.lower().strip()
d2 = d2.lower().strip()
return difflib.SequenceMatcher(None, d1, d2).ratio() == accuracy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment