How to check if two Strings are approximately equal?

前端 未结 6 2058
醉酒成梦
醉酒成梦 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 06:08

    See this question and answer: Getting the closest string match

    Using some heuristics and the Levenshtein distance algorithm, you can compute the similarity of two strings and take a guess at whether they're equal.

    enter image description here

    Your only option other than that would be a dictionary of accepted words similar to the one you're looking for.

提交回复
热议问题