Make Levenshtein a proper differ instead of a hacky mode #147
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Levenshtein should be a proper Differ class, not hacked into metrics.
This PR does the necessary changes to achieve that.
get_opcode_counts
andget_error_rate
(especially in the case of Levenshtein this can allow for huge speed and memory gains as for large texts the Levenshtein algorithm needs a big matrix to properly determine the least expensive path)Known issues:
Levenshtein
package (only supports strings, so not usable)edit-distance
package at the moment, but it does not give the proper results for lists. The package is bugged for opcodes and I cannot currently invest the time to fix it or even file a proper error report and unit tests to the maintainer.It seems to me that we should probably only support Levenshtein for distance, not for the opcodes at the moment, editops totals ("opcode counts") might be feasible, have not yet looked at the implementations here as I really wanted to get full and correct opcodes so that we could display the entire diff between ref and hyp.