nbdime icon indicating copy to clipboard operation
nbdime copied to clipboard

Implementing an edit distance function for any kind of diffable object

Open martinal opened this issue 10 years ago • 0 comments

An edit distance function can be used to define approximate equality. The function needs to cover any type of diffable object, including nested dict and list structures.

For comparing strings, one alternative is the python-Levenshtein package:

https://github.com/ztane/python-Levenshtein/

This was used by the nbdiff.org project.

For strings or tuples containing lines of strings, difflib.SequenceMatcher(...).ratio()|quick_ratio() could be used, possibly using the autojunk heuristic to ignore blank lines.

For arbitrary nested structures we will anyway need a custom implementation.

martinal avatar Dec 17 '15 08:12 martinal