How to check if two Strings are approximately equal?

前端 未结 6 2015
醉酒成梦
醉酒成梦 2021-02-04 05:30

I\'m making a chat responder for a game and i want know if there is a way you can compare two strings and see if they are approximatley equal to each other for example:

6条回答
  •  花落未央
    2021-02-04 05:47

    If you want to find similar word beginnings, you can use a stemmer. Stemmers reduce words to a common beginning. The most known algorithm if the Port Stemmer (http://tartarus.org/~martin/PorterStemmer).

    Levenshtein, as pointed above, is great, but computational heavy for distances greater than one or two.

提交回复
热议问题