pub trait SemanticScorer: Send + Sync {
// Required method
fn similarity<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
document: &'life2 str,
) -> Pin<Box<dyn Future<Output = f64> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Pluggable semantic similarity between two texts.
Implementations return a value in [0, 1] (1 = identical meaning). Embedding-based
scorers can back this trait; the default LexicalScorer needs no model.
Required Methods§
Sourcefn similarity<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
document: &'life2 str,
) -> Pin<Box<dyn Future<Output = f64> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn similarity<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
document: &'life2 str,
) -> Pin<Box<dyn Future<Output = f64> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Similarity between query and document in [0, 1].
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".