Last active
August 29, 2015 14:05
-
-
Save langner/08164c88bb37cb18b6d1 to your computer and use it in GitHub Desktop.
Python function for testing similarity of two DOIs
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
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