Skip to main content

AsyncEntityExtractor

Trait AsyncEntityExtractor 

Source
pub trait AsyncEntityExtractor: Send + Sync {
    type Entity: Send + Sync;
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn extract<'life0, 'life1, 'async_trait>(
        &'life0 self,
        text: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Entity>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn extract_with_confidence<'life0, 'life1, 'async_trait>(
        &'life0 self,
        text: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(Self::Entity, f32)>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set_confidence_threshold<'life0, 'async_trait>(
        &'life0 mut self,
        threshold: f32,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_confidence_threshold<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = f32> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn extract_batch<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        texts: &'life1 [&'life2 str],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<Self::Entity>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn extract_batch_concurrent<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        texts: &'life1 [&'life2 str],
        max_concurrent: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<Self::Entity>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Async entity extraction abstraction for non-blocking entity extraction

§Async Version

This trait provides async operations for entity extraction with better throughput for large texts.

Required Associated Types§

Source

type Entity: Send + Sync

The entity type this extractor produces

Source

type Error: Error + Send + Sync + 'static

The error type returned by extraction operations

Required Methods§

Source

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

Extract entities from text

Source

fn extract_with_confidence<'life0, 'life1, 'async_trait>( &'life0 self, text: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<(Self::Entity, f32)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Extract entities with confidence scores

Source

fn set_confidence_threshold<'life0, 'async_trait>( &'life0 mut self, threshold: f32, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set minimum confidence threshold

Source

fn get_confidence_threshold<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = f32> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get current confidence threshold

Provided Methods§

Source

fn extract_batch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, texts: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<Self::Entity>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Extract entities from multiple texts in batch

Source

fn extract_batch_concurrent<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, texts: &'life1 [&'life2 str], max_concurrent: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<Self::Entity>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Extract entities from multiple texts with concurrency control

Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Health check for entity extractor

Implementors§