Skip to content

Instantly share code, notes, and snippets.

@muratcorlu
Created April 6, 2014 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muratcorlu/10009657 to your computer and use it in GitHub Desktop.
Save muratcorlu/10009657 to your computer and use it in GitHub Desktop.
Get similarity score of two words with python
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