Kristian Rickert created OPENNLP-1920:
-----------------------------------------

             Summary:   Add dependency-path relation extraction as a typed 
Document annotation layer
                 Key: OPENNLP-1920
                 URL: https://issues.apache.org/jira/browse/OPENNLP-1920
             Project: OpenNLP
          Issue Type: Improvement
          Components: language model
            Reporter: Kristian Rickert
            Assignee: Kristian Rickert


h3. Background

OPENNLP-1919 exposes dependency parses as a typed Document annotation layer. 
Once entity mentions and dependency arcs are available, OpenNLP can support 
deterministic relation extraction over dependency paths without representing 
relations as unstructured metadata.

This issue introduces a rule-based relation extraction API. It does not claim 
to provide a generic statistical relation extraction model.

h3. Proposed work

* Add an immutable {{RelationMention}} value type containing:
** relation type
** subject entity index
** object entity index
* Add a {{RelationPattern}} type describing:
** relation type
** direction-aware dependency path
** optional pivot trigger
* Add a stateless, thread-safe {{RelationAnnotator}}.
* Consume the typed token, entity, and dependency layers.
* Identify the dependency head of single-token and multi-token entity mentions.
* Compute the dependency path between ordered entity pairs through their lowest 
common ancestor.
* Match dependency labels with explicit traversal direction.
* Optionally constrain a match using a normalized pivot trigger.
* Emit a typed {{opennlp:relations}} layer.
* Reference subject and object annotations by their indexes in the entity layer.
* Anchor each relation annotation to the document span covering both entity 
mentions.
* Preserve deterministic output ordering based on entity order and pattern 
registration order.
* Validate dependency alignment, arc indexes, duplicate dependents, cycles, and 
malformed entity references.
* Document the relation pattern syntax and provide a complete usage example.

This issue depends on OPENNLP-1919 and therefore transitively on OPENNLP-547 
and OPENNLP-1888.

gRPC configuration and exposure remain part of OPENNLP-1833.

h3. Acceptance criteria

* Relations are emitted through a typed Document layer.
* Subject and object indexes reference valid entity-layer entries.
* Tests cover direct paths, paths through a lowest common ancestor, reversed 
entity pairs, root arcs, multi-token entities, optional triggers, and multiple 
matching rules.
* Tests cover unmatched patterns, entities sharing the same dependency head, 
disconnected graphs, cyclic graphs, malformed indexes, and missing prerequisite 
layers.
* Empty valid input produces a present but empty relation layer.
* Existing immutable Document layers are not modified.
* Public APIs and validation failures have complete Javadocs and actionable 
messages.
* The user manual documents the rule format, prerequisites, and output shape.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to