Skip to main content

RelationCapable

Trait RelationCapable 

Source
pub trait RelationCapable: Model {
    // Required method
    fn extract_with_relations(
        &self,
        text: &str,
        language: Option<&str>,
    ) -> Result<(Vec<Entity>, Vec<Relation>)>;
}
Expand description

Trait for models that can extract relations between entities.

Models implementing this trait can jointly extract entities and their relationships, producing (head, relation_type, tail) triples.

Required Methods§

Source

fn extract_with_relations( &self, text: &str, language: Option<&str>, ) -> Result<(Vec<Entity>, Vec<Relation>)>

Extract entities and their relations from text.

§Arguments
  • text - Input text to extract from
  • language - Optional language hint (e.g., “en”, “es”)
§Returns

A tuple of (entities, relations) where relations link entities together.

Implementors§

Source§

impl RelationCapable for GLiNER2Onnx

Available on crate feature onnx only.
Source§

impl RelationCapable for TPLinker