rlevenshtein-distanceedit-distance

Custom replacement matrix for edit distance in R


I need to compute the edit distance between two strings based on a custom cost function for replacements. For example, I want to specify different cost for replacing 'a' with 'b' than replacing 'a' with 'c'

Is there an R package that allows me to pass a custom cost matrix as an argument? If not, I will have to modify a package for this purpose, then which package do you think is good for implementing this kind of extension?

Thanks.


Solution

  • I came to the conclusion that there is no such package which is capable of doing what I needed. Therefore, I had to come up with my own solution to this problem by writing an R package (which is not indeed generic -easy to adapt for other applications) capable of doing what I need.

    here it is for the curious -> https://github.com/aanilpala/r-trajectory-editdistance