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

Improve readability of diff_cleanupSemantic #26

Open
TravisJRyan opened this issue Jul 24, 2024 · 0 comments
Open

Improve readability of diff_cleanupSemantic #26

TravisJRyan opened this issue Jul 24, 2024 · 0 comments

Comments

@TravisJRyan
Copy link

Issue

The readability of diff_cleanupSemantic could be improved. While it's promoted for use when a human needs to read the diff per the README, I'm still seeing that words are partially split. I think the algorithm should always try and make diffs of words/phrases complete and not interrupted in between words.

The use case is building a UI where semantic diffs are key to track before/after changes to some text.

Example

Before: The dog was a little hungry.
After: The duck was a bit hungry.

Expected:
"dog" is completely crossed out in place of "duck", and "little" is completed crossed out in place of "bit".

Actual output:
diff-example

The above takes a lot of mental energy to understand, so it's not feasible for humans to use this to understand the diff for a large piece of text, as these types of issues occur frequently. Some way to more aggressively try and separate words/phrases into readable diffs would be preferred here.

I've also tried using diff_efficientCleanup with varying edit distances, but it doesn't seem to fully get rid of this problem, as the algorithm needs more knowledge about how to split on words/phrases for readability.

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

1 participant