-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add code for computing optional sequence diffs #2865
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2865 +/- ##
==========================================
+ Coverage 67.48% 67.51% +0.02%
==========================================
Files 325 327 +2
Lines 41633 41743 +110
==========================================
+ Hits 28097 28181 +84
- Misses 11957 11978 +21
- Partials 1579 1584 +5 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Thanks for adding the property based test
ys []T | ||
} | ||
|
||
func (d *differ[T]) difflen() *matrix { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does difflen
stand for? I assumed this was "diff length" at first look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's right. It may be better termed edit distance or cost matrix.
This PR has been shipped in release v3.102.0. |
Originating from t0yv0/godifft - this may be useful for computing list diffs for display. Compared to the https://github.com/t0yv0/godifft version adds rapid tests and a function to apply the edit sequence.
Note that memory is still O(N^2) for large strings, and the naive matrix implementation may allocate a lot of memory. This is intended for comparing fairly short strings <1000 in length.