11 lines
227 B
Python
11 lines
227 B
Python
# calculate similarity between two strings
|
|
from difflib import SequenceMatcher
|
|
|
|
|
|
def similarity(a, b):
|
|
return SequenceMatcher(None, a, b).ratio()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print(similarity("Dr. Stone", "Dr. STONE"))
|