Skip to main content

DynamicLabels

Trait DynamicLabels 

Source
pub trait DynamicLabels: Model {
    // Required method
    fn extract_with_labels(
        &self,
        text: &str,
        labels: &[&str],
        language: Option<&str>,
    ) -> Result<Vec<Entity>>;
}
Expand description

Trait for models that support dynamic/zero-shot entity type specification.

Models implementing this trait can extract entities of arbitrary types specified at inference time (e.g., GLiNER, UniversalNER), rather than being limited to a fixed set of pre-trained types.

Required Methods§

Source

fn extract_with_labels( &self, text: &str, labels: &[&str], language: Option<&str>, ) -> Result<Vec<Entity>>

Extract entities with custom type labels.

§Arguments
  • text - Input text to extract from
  • labels - Custom entity type labels to extract (e.g., [“PERSON”, “ORGANIZATION”])
  • language - Optional language hint (e.g., “en”, “es”)
§Returns

Entities of the specified types found in the text.

Implementors§