#NEWLINE# def similarity( string1 , string2 , metric = LEVENSHTEIN ) : #NEWLINE# #INDENT# ' Returns the similarity of string1 and string2 as a number between 0.0 and 1.0,\n        using LEVENSHTEIN edit distance or DICE coefficient.\n    ' #NEWLINE# if ( metric == LEVENSHTEIN ) : #NEWLINE# #INDENT# return levenshtein_similarity ( string1 , string2 ) #NEWLINE# #UNINDENT# if ( metric == DICE ) : #NEWLINE# #INDENT# return dice_coefficient ( string1 , string2 )