有一个名为RecordLinkage 的包,其中包括levenshteinSim 和levenshteinDist 函数。
此软件包已过期,但可以与old versions 的源文件一起安装。
这里是RecordLinkagepackage manifest;的levenshteinSim功能说明
Details
String metrics compute a similarity value in the range [0, 1] for two strings, with 1 denoting the
highest (usually equality) and 0 denoting the lowest degree of similarity. In the context of Record
Linkage, string similarities can improve the discernibility between matches and non-matches.
jarowinkler is an implementation of the algorithm by Jaro and Winkler (see references). For the
meaning of W_1, W_2, W_3 and r see the referenced article. For most applications, the default values
are reasonable.
levenshteinDist returns the Levenshtein distance, which cannot be directly used as a valid string
comparator. levenshteinSim is a similarity function based on the Levenshtein distance, calculated
by 1 −
d(str1,str2)
max(A,B)) , where d is the Levenshtein distance function and A and B are the lenghts of the
strings.
Arguments str1 and str2 are expected to be of type "character".
您可以通过这种方式使用 .tar.gz 从源文件安装软件包;
How do I install an R package from source?