OPENNLP-1919: Expose dependency parses as a typed Document annotation layer - #1237
Draft
krickert wants to merge 9 commits into
Draft
OPENNLP-1919: Expose dependency parses as a typed Document annotation layer#1237krickert wants to merge 9 commits into
krickert wants to merge 9 commits into
Conversation
Wires the dependency parser into the document pipeline: reads the token and tag layers, parses, and provides a dependencies layer with one DependencyArc per token anchored on the dependent's span. Arc head and dependent are indices into the token layer, exercising the container rule that annotations reference each other by layer and index; the test resolves an arc's head through the token layer back to its span in the original text. (cherry picked from commit 902fbb3)
…ocument-coordinate javadoc
… boundaries The annotator now rejects a parser that returns a graph over a different token count than its sentence, instead of silently misaligning the dependency layer with the token layer, and the javadoc states the text-order requirement the walk has always relied on. New tests pin the empty-sentence index shift, a token straddling two sentence spans, the stuck-scan path behind a gap token, and the graph-size rejection. The staged copy of the document container was refreshed to the current foundation, whose adapters parse per sentence and whose empty-versus-missing layer distinction moves the empty-text failure into this annotator's own validation.
…ample Add a DependencyAnnotator section to the dependency chapter citing DependencyAnnotatorPipelineTest.
Open the CDATA on its own line so the rendered code block has no leading blank line, matching the two listings above it and parser.xml.
…t cleanup - Check each required layer for presence on its own, so a document missing the sentence, token, or tag layer is rejected with a message that names the key that is absent instead of being folded into the alignment complaint. - Accept present-but-empty required layers: a document with no sentences and no tokens now yields a present-but-empty dependencies layer rather than an IllegalArgumentException, which is the empty-versus-absent distinction the rest of the container annotators already follow. - Extract the shared rejection prefix into a MISSING_LAYER constant so all three absence checks emit one message shape. - Restate the annotate() javadoc and its @throws list against the checks that are actually performed, and say explicitly that the required layers may be empty. - Trim commentary that only repeated the javadoc: the class-level narration about being the first graph-shaped layer, the unwrap-the-slice comment, and the document-coordinate tail of the index-shift comment. - Replace the three hand-rolled absent-layer assertions with a parameterized test over one document per required layer, asserting the message names that layer. - Add pinning tests for the null-document message and for the empty document producing a present-but-empty arc layer, and flip the pipeline test on empty text to assert the same pass-through instead of a failure. - Assert the exact message in testMissingLayersThrow rather than only the exception type. - Hoist the one-token parser stub to a ONE_TOKEN_ROOT constant shared by the two tests that had declared it inline, and extract the repeated STRAY_TOKEN and MISALIGNED expected messages into constants. - Drop the two docbook sentences that pointed readers at test class names, state the present-but-empty layer contract in the annotator section, and correct "indexes" to "indices" in the example comment.
krickert
added a commit
to ai-pipestream/opennlp
that referenced
this pull request
Aug 22, 2026
…RPC helper base
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stack
This draft depends on OPENNLP-547 and OPENNLP-1888. It must remain draft until both dependencies land.