3

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.

bfaskiplar
  • 865
  • 1
  • 7
  • 23
  • It looks like `adist` in the `utils` package does this. – Seth Mar 26 '14 at 14:54
  • this is to assign different unit costs to different kind of operations. what I needed was a function of two characters that computes different costs for different character pairs. e.g insertion('a','b') = 2, insertion(d,e) = 7 – bfaskiplar Mar 26 '14 at 16:34

1 Answers1

0

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

bfaskiplar
  • 865
  • 1
  • 7
  • 23