Skip to content

Recursively searching for non-empty ancestors of enhanced dependencies with empty parents #123

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

Merged
merged 2 commits into from
Apr 15, 2024

Conversation

michnov
Copy link
Contributor

@michnov michnov commented Apr 14, 2024

The current solution of deleting enhanced dependencies (deps field) to empty parents fails in validation tests with a few error of the following type:

[(in cs_pcedt-ud-test-blind.conllu) Line 62051 Sent wsj2387-001-p1s47]: [L2 Enhanced unconnected-egraph] Enhanced graph is not connected. Nodes ['34', '35', '36', '37', '38', '39', '40', '41'] are not reachable from any root
Enhanced errors: 1
*** FAILED *** with 1 errors

The reason is that it just deletes the dependencies to empty parents and replaces them with a dependency to "0:root" only if no other has left. However, exceptionally it happens that a dependency to an empty parent is the only connection of a set of nodes to the rest of the tree, making them unreachable from the root after deleting the empty parent.

The suggested solution first checks if the root remains reachable after deletion of all empty nodes. If yes, it just removes the empty-parent dependencies. Otherwise, it tries to replace the dependency to an empty parent with the empty parent's dependencies. If these deps also contain an empty-parent dependency, replacing is recursively repeated to the ancestors until all dependencies point to non-empty parents. If no non-empty parents can be found during this procedure (a cycle is encountered), the problematic dependency is replaced with 0:root.

@michnov michnov marked this pull request as ready for review April 14, 2024 12:46
@martinpopel martinpopel merged commit f2987e6 into master Apr 15, 2024
@martinpopel martinpopel deleted the corefud_delete_fix branch April 15, 2024 16:28
@martinpopel
Copy link
Contributor

Thanks. I have some suggestions for code improvements, but I need to merge in other commits first. So merging this PR now as it is.

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

Successfully merging this pull request may close these issues.

2 participants