string-comparison

How do I convert between a measure of similarity and a measure of difference (distance)?

Is there a general way to convert between a measure of similarity and a measure of distance? Consider a similarity measure like the number of 2-grams that two strings have in common. 2-grams('beta', 'delta') = 1 2-grams('apple', 'dappled') = 4 What if I need to feed this to an optimization algorithm that expects a measure of differen...