且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查两个字符串是否大致相等?

更新时间:2022-11-17 14:28:31

参见这个问题和答案:获得最接近的字符串匹配

See this question and answer: Getting the closest string match

使用一些启发式算法和 Levenshtein距离算法,你可以计算两个字符串的相似性,并猜测它们是否相等。

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.

除此之外,您唯一的选择是与您正在寻找的词语类似的词典。

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