andreasvc / disco-dop

Discontinuous Data-Oriented Parsing
http://discodop.readthedocs.io
GNU General Public License v2.0
46 stars 16 forks source link

Fix collapseunary #70

Open minacode opened 2 years ago

minacode commented 2 years ago

I got a ValueError from applying treetransforms.collapseunary on (B (E (C (a 0) (b 1)) (c 2))), ecpecting (B+E (C (a 0) (b 1)) (c 2)):

ValueError: Cannot insert a subtree that already has a parent.

I found, that this occurs, because the parent reference E is not deleted in Es children before they are assigned to the new parent B+E.