[−][src]Trait finalfusion::similarity::Analogy
Trait for analogy queries.
Required methods
fn analogy_masked(
&self,
query: [&str; 3],
remove: [bool; 3],
limit: usize
) -> Result<Vec<WordSimilarityResult>, [bool; 3]>
&self,
query: [&str; 3],
remove: [bool; 3],
limit: usize
) -> Result<Vec<WordSimilarityResult>, [bool; 3]>
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.
Result::Err
is returned when no embedding could be computed
for one or more of the tokens, indicating which of the tokens
were present.
Provided methods
fn analogy(
&self,
query: [&str; 3],
limit: usize
) -> Result<Vec<WordSimilarityResult>, [bool; 3]>
&self,
query: [&str; 3],
limit: usize
) -> Result<Vec<WordSimilarityResult>, [bool; 3]>
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. Result::Err
is returned
when no embedding could be computed for one or more of the tokens,
indicating which of the tokens were present.
Implementors
impl<V, S> Analogy for Embeddings<V, S> where
V: Vocab,
S: StorageView,
[src]
V: Vocab,
S: StorageView,