Created
April 6, 2014 18:15
-
-
Save muratcorlu/10009657 to your computer and use it in GitHub Desktop.
Get similarity score of two words with python
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 get_score(word1, word2): | |
shared_chars = [char for char in word1.lower() if char in word2.lower()] | |
return len(shared_chars) | |
# Usage | |
get_score('murat', 'burak') | |
# > 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment