String similarity score/hash

前端 未结 12 1230
长发绾君心
长发绾君心 2020-12-07 09:52

Is there a method to calculate something like general \"similarity score\" of a string? In a way that I am not comparing two strings together but rather I get some number (h

12条回答
  •  孤城傲影
    2020-12-07 10:54

    This isn't possible, in general, because the set of edit distances between strings forms a metric space, but not one with a fixed dimension. That means that you can't provide a mapping between strings and integers that preserves a distance measure between them.

    For example, you cannot assign numbers to these three phrases:

    • one two
    • one six
    • two six

    Such that the numbers reflect the difference between all three phrases.

提交回复
热议问题