[−][src]Trait finalfusion::similarity::Analogy
Trait for analogy queries.
Required methods
fn analogy_masked(
&self,
word1: &str,
word2: &str,
word3: &str,
limit: usize,
remove: [bool; 3]
) -> Option<Vec<WordSimilarity>>
&self,
word1: &str,
word2: &str,
word3: &str,
limit: usize,
remove: [bool; 3]
) -> Option<Vec<WordSimilarity>>
Perform an analogy query.
This method returns words that are close in vector space for the
analogy query word1
is to word2
as word3
is to ?
. More
concretely, it searches embeddings that are similar to:
embedding(word2) - embedding(word1) + embedding(word3)
At most, limit
results are returned.
remove
specifies which parts of the queries are excluded from the
output candidates. If remove[0]
is true
, word1
cannot be
returned as an answer to the query.
Provided methods
fn analogy(
&self,
word1: &str,
word2: &str,
word3: &str,
limit: usize
) -> Option<Vec<WordSimilarity>>
&self,
word1: &str,
word2: &str,
word3: &str,
limit: usize
) -> Option<Vec<WordSimilarity>>
Perform an analogy query.
This method returns words that are close in vector space the analogy
query word1
is to word2
as word3
is to ?
. More concretely,
it searches embeddings that are similar to:
embedding(word2) - embedding(word1) + embedding(word3)
At most, limit
results are returned.
Implementors
impl<V, S> Analogy for Embeddings<V, S> where
V: Vocab,
S: StorageView,
[src]
V: Vocab,
S: StorageView,