How do I compare phrases for similarity?

前端 未结 4 1065
无人共我
无人共我 2021-02-03 10:36

When entering a question, stackoverflow presents you with a list of questions that it thinks likely to cover the same topic. I have seen similar features on other sites or in ot

4条回答
  •  情深已故
    2021-02-03 10:57

    @Hanno you should try the Levenshtein distance algorithm. Given an input string s and a list of of strings t iterate for each string u in t and return the one with the minimum Levenshtein distance.

    http://en.wikipedia.org/wiki/Levenshtein_distance

    See a Java implementation example in http://www.javalobby.org/java/forums/t15908.html

提交回复
热议问题