Last active
September 23, 2019 17:30
-
-
Save jaradc/14c1aa7bbb6ba3bf915ec0b055125185 to your computer and use it in GitHub Desktop.
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 | |
""" | |
This simple piece of code can help detect similar strings using SequenceMatcher | |
""" | |
data = ['temporary tatoos', 'temporary tatto', 'tempoary tatoo', 'tempoary tattoo', 'temporary tattoos'] | |
for line in data: | |
for word in line.split(): | |
i = difflib.SequenceMatcher(None, word, 'tattoo').ratio() | |
if i > 0.6: | |
print(word, i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment