Skip to content

Include token in subgraph even if not covered by segmentation node#334

Open
matthias-stemmler wants to merge 2 commits intokorpling:mainfrom
matthias-stemmler:fix-subgraph-for-uncovered-token
Open

Include token in subgraph even if not covered by segmentation node#334
matthias-stemmler wants to merge 2 commits intokorpling:mainfrom
matthias-stemmler:fix-subgraph-for-uncovered-token

Conversation

@matthias-stemmler
Copy link
Copy Markdown
Contributor

This fixes a regression I introduced in #289: When subgraph is called with a token and a segmentation, and the token is not covered by any segmentation node, then the token is not included in the subgraph.

In #289 I had filtered out matched tokens to ensure that tokens are sorted, claiming that new_overlapped_nodes_iterator already included the matched tokens. However, if a segmentation is specified, this is only true for tokens that are covered by a segmentation node.

The fix changes get_left_right_token_with_offset_with_segmentation so that instead of failing, it returns just the covered tokens without context in case none of them is covered by a segmentation node.

I hope this doesn't break any other invariants. At least the existing tests are still green. 🙂

@matthias-stemmler
Copy link
Copy Markdown
Contributor Author

I added another test to close the (pre-existing) gap in test coverage. The remaining CI failure seems to be a permissions issue.

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.

1 participant