What are some algorithms for comparing how similar two strings are?

后端 未结 5 1453
故里飘歌
故里飘歌 2020-11-30 17:45

I need to compare strings to decide whether they represent the same thing. This relates to case titles entered by humans where abbreviations and other small details may di

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 18:45

    You could use ngrams for that. For example, transform the two strings in word trigrams (usually lowercase) and compare the percentage of them that are equal to one another.

    Your challenge is to define a minimum percentage for similarity.

    http://en.wikipedia.org/wiki/N-gram

提交回复
热议问题