-
Notifications
You must be signed in to change notification settings - Fork 45
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
The cost is not optimal #89
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
output:
But the minimal cost should be 3.
output:
I found the problem is in
EditDistance._best_match
:brow = row, bcol = col-1
(condition3 success) becauseself.edit_matrix[row][col].bounds() == self.edit_matrix[0][col].bounds()
(condition1 fail) anducost > dcost
(condition2 fail).But actually
self.costs[row][col-1] self.edit_matrix[0][col].bounds().upper_bound > self.costs[row-1][col-1] self.edit_matrix[row][col].bounds().upper_bound
. The optimalself.costs[row][col]
should beself.costs[row-1][col-1] self.edit_matrix[row][col].bounds().upper_bound
.Here is a fix (success in the above example, may need further testing):
In summary, we should use the final real cost to guide transition. Like the canonical implementation of the Levenshtein distance metric:
If this is a bug, I would be happy to provide a PR.
The text was updated successfully, but these errors were encountered: