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

前端 未结 8 1730
悲&欢浪女
悲&欢浪女 2021-02-02 01:57

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 ha

8条回答
  •  难免孤独
    2021-02-02 02:34

    In the case of Levenshtein distance, you could increase the sim score by 1 for every time the sequences match; that is, 1 for every time you didn't need a deletion, insertion or substitution. That way the metric would be a linear measure of how many characters the two strings have in common.

提交回复
热议问题