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

How to minimize the number of insertions? #167

Open
nachocab opened this issue Feb 15, 2017 · 2 comments
Open

How to minimize the number of insertions? #167

nachocab opened this issue Feb 15, 2017 · 2 comments

Comments

@nachocab
Copy link

image

The example above showcases what I'm trying to do: the first line has two insertions ("very", "correct and"), while the second line only has one insertion ("and correct"). Is there a parameter I could use to penalize gap opening? That way, the first example would have a single insertion "very and correct"

@ExplodingCabbage
Copy link
Collaborator

No such option currently; we don't have any concept of customising edit costs / penalties. Implementing anything along these lines would probably be a pretty major algorithm change, I think (except maybe something that uses this as a way to tiebreak between routes of equal edit distance - but I'm not totally sure that even that is straightforward!).

@ExplodingCabbage
Copy link
Collaborator

I'll have a think about this, and will read up on diffing algorithms that allow custom gap penalties (like Smith-Waterman and Needleman-Wunsch) but if I ultimately conclude that this would require a fundamentally different algorithm to the Myers diff algorithm that jsdiff currently uses, I'll probably close this.

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

No branches or pull requests

2 participants