String similarity algorithms?

前端 未结 5 564
傲寒
傲寒 2020-11-27 13:00

I need to compare 2 strings and calculate their similarity, to filter down a list of the most similar strings.

Eg. searching for \"dog\" would return

  1. d
5条回答
  •  我在风中等你
    2020-11-27 13:46

    The Levenshtein distance is the algorithm I would recommend. It calculates the minimum number of operations you must do to change 1 string into another. The fewer changes means the strings are more similar...

提交回复
热议问题