It would be nice if similarity is commutative. Requirements: diff("", "") = 0 diff("", "a") > diff("", """) diff("one two three", "one two four") > diff("one two three", "one two three") diff("one two three", "one five four") > diff("one two three", "one three three") diff("one two three", "one five four") > diff("one two three", "one three four")