-
Notifications
You must be signed in to change notification settings - Fork 26
Showing a trace of the operations #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I wanted to file the same feature request: I was hoping for something like |
@smeylan looking exactly for the same thing! have you found something to solve your problem? |
I'm looking for the same thing, or the output matrix at the very least. There are tutorials and StackOverflow answers that talk about how to get from the matrix to the edit path, but I can't figure out how to get the matrix itself from the lev() function in this package. |
To my understanding there are two problems: a) There is no clear solution at equal cost for multiple paths. b) There is no memory about which path was choosen. Decision logic is inside the multiple |
a) That's correct. The minimal path is not necessarily unique. b) The edit path should be constructable from the dynamic programming array itself, since the |
Below is a function I wrote to intake a cost matrix and trace it back. The path is non-unique and, depending on the costs input into the original distance, will likely have several choices to make. The order in which these are made is arbitrary, and can be re-ordered by preference. This code is Now all we need is the
|
Hi, thanks for this implementation, it calculates the distance that I need as I need to have custom substitution costs, but also have relatively expensive (but fixed) insertion and deletion costs.
However, I also need to know what operations take place to arrive at the costs (i.e. an order of operations to go from string 1 to string 2, such as "SMMMMM" for HANANA->BANANA). I need this in order to match elements from one sequence to equal or substituted elements in the other sequence, which in my application has metadata. If multiple are possible, the first one will do.
The backtracing algorithms I've found online no longer work when substitution is cheaper than insertion/deletion, and I don't quite understand why. I figure it's simpler to keep track of the operations throughout the execution of the algorithm. However, I haven't been able to produce an output in that way either that works well with custom weights.
I would greatly appreciate any insight into how this could be achieved or why it couldn't work.
The text was updated successfully, but these errors were encountered: