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

Different diffs produce same Operation lists #56

Open
SamWilsn opened this issue Jun 19, 2023 · 0 comments
Open

Different diffs produce same Operation lists #56

SamWilsn opened this issue Jun 19, 2023 · 0 comments

Comments

@SamWilsn
Copy link

I'm attempting to use zss to create a reasonable "patch" between two trees. The following two tree-pairs produce the same set of operations, and I'm not sure how you're supposed to differentiate between them:

graph TD;
    A-->C;
    A-->B;
Loading
from zss import Node, simple_distance

before = Node("A")
after = Node("A").addkid(Node("C")).addkid(Node("B"))

_, ops = simple_distance(before, after, return_operations=True)
graph TD;
    A-->B;
    B-->C;
Loading
from zss import Node, simple_distance

before = Node("A")
after = Node("A").addkid(Node("B").addkid(Node("C")))

_, ops = simple_distance(before, after, return_operations=True)

Which both result in:

<Operation Insert: None to Node('C')>
<Operation Insert: None to Node('B')>
<Operation Match: Node('A') to Node('A')>

Is this ambiguity intentional (since this is primarily an edit distance library), or am I missing something?

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