[][src]Trait finalfusion::similarity::EmbeddingSimilarity

pub trait EmbeddingSimilarity {
    fn embedding_similarity_masked(
        &self,
        query: ArrayView1<f32>,
        limit: usize,
        skips: &HashSet<&str>
    ) -> Option<Vec<WordSimilarityResult>>; fn embedding_similarity(
        &self,
        query: ArrayView1<f32>,
        limit: usize
    ) -> Option<Vec<WordSimilarityResult>> { ... } }

Trait for embedding similarity queries.

Required methods

fn embedding_similarity_masked(
    &self,
    query: ArrayView1<f32>,
    limit: usize,
    skips: &HashSet<&str>
) -> Option<Vec<WordSimilarityResult>>

Find words that are similar to the query embedding while skipping certain words.

The similarity between the query embedding and other embeddings is defined by the dot product of the embeddings. If the vectors are unit vectors (e.g. by virtue of calling normalize), this is the cosine similarity. At most, limit results are returned.

Loading content...

Provided methods

fn embedding_similarity(
    &self,
    query: ArrayView1<f32>,
    limit: usize
) -> Option<Vec<WordSimilarityResult>>

Find words that are similar to the query embedding.

The similarity between the query embedding and other embeddings is defined by the dot product of the embeddings. If the vectors are unit vectors (e.g. by virtue of calling normalize), this is the cosine similarity. At most, limit results are returned.

Loading content...

Implementors

impl<V, S> EmbeddingSimilarity for Embeddings<V, S> where
    V: Vocab,
    S: StorageView
[src]

Loading content...