curran / curran/google-diff-match-patch
Semantic cleanup: "eliminate equalility" and "extract overlap" passes conflict
- Dominant language
- Python
- Stars
- 17
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
```
Because both passes use non-strict inequality they end up doing double work in
some cases.
Take for example, the following case:
...abcdefghi...
On the first "eliminate equality" pass the equality will be merged into edits
because quality length (3) is <= than edits length on both sides (3).
So it will become:
...abcdefdefghi...
Then on the second "extract overlap" pass the two above edits overlap will be
extracted back because overlap length (3) >= edit length (6) / 2.
So everything will be reverted to:
...abcdefghi...
It seems, the quick and easy fix for this is to make the second pass comparison
strict - use > instead of >=
Here:
if (overlap_length1 > deletion.length() / 2 || overlap_length1 >
insertion.length() / 2)
and here:
if (overlap_length2 > deletion.length() / 2 || overlap_length2 >
insertion.length() / 2)
```
Original issue reported on code.google.com by `2sa...@gmail.com` on 20 Jun 2012 at 7:25
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.