Skip to main content

EntityExtractor

Trait EntityExtractor 

Source
pub trait EntityExtractor: Send + Sync {
    // Required method
    fn extract<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        text: &'life1 str,
        hints: &'life2 [EntityRef],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<EntityRef>, MemoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Extracts typed entity references from text.

Implementations include BuiltinExtractor (regex, M2), LlmEntityExtractor (M2), FallbackExtractor (chain primary→secondary on empty, M2). Tests use a FakeExtractor returning a fixed set.

Required Methods§

Source

fn extract<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, text: &'life1 str, hints: &'life2 [EntityRef], ) -> Pin<Box<dyn Future<Output = Result<Vec<EntityRef>, MemoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Extract entities from text, merging with caller-supplied hints.

Hints take precedence — extractor implementations dedupe by (EntityType::as_str(), name) and never drop a hint silently.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§