Skip to content
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

Diff is calculating very wrong results #142

Open
ogil7190 opened this issue Apr 27, 2023 · 1 comment
Open

Diff is calculating very wrong results #142

ogil7190 opened this issue Apr 27, 2023 · 1 comment

Comments

@ogil7190
Copy link

While using the library, I have noticed that there is a serious problem with text diff, a very simple example is not working fine, looking at the code developed by google, it was hard for me to believe that, why it is not working fine. If you look at the screenshot below you will see that it is almost correct, but very wrong in results.

It is saying i have added certain lines, which were already a part of the original and input string.
Second, it has seriously messed up the order, in which they occur.

CAN ANYONE HELP HERE?

image

@dmsnell
Copy link

dmsnell commented Apr 28, 2023

Hi @ogil7190 - I'm seeing what looks like accurate output, so maybe you could share what you see as being wrong in the output specifically.

It's not showing that you've added lines at all, for example, only that the last eight words and additional u letter are not present in the input after removing the rest of the first paragraph.

The diffs are a recipe to move from the first version to the second, and there's no guarantee that what it produces is going to be the same "edit script" you expect it to be. For some reason it recognized the long paragraph removal as a single deletion and added back in the part where the y changed into a u. It could have also deleted the y, inserted a u, kept the rest of the sentence, then deleted everything else.

The important point to note though is that the patch should generate the second text when applied to the first, which in this case it looks like it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants