Returns the similarity of string1 and string2 as a number between 0.0 and 1.0.
(string1, string2)
| 269 | edit_distance = levenshtein |
| 270 | |
| 271 | def levenshtein_similarity(string1, string2): |
| 272 | """ Returns the similarity of string1 and string2 as a number between 0.0 and 1.0. |
| 273 | """ |
| 274 | return 1 - levenshtein(string1, string2) / float(max(len(string1), len(string2), 1.0)) |
| 275 | |
| 276 | def dice_coefficient(string1, string2): |
| 277 | """ Returns the similarity between string1 and string1 as a number between 0.0 and 1.0, |
no test coverage detected
searching dependent graphs…