pub struct Embeddings<V, S> { /* private fields */ }
👎Deprecated: rust2vec is superseded by the finalfusion crate
Expand description
Word embeddings.
This data structure stores word embeddings (also known as word vectors) and provides some useful methods on the embeddings, such as similarity and analogy queries.
Implementations§
Source§impl<V, S> Embeddings<V, S>
impl<V, S> Embeddings<V, S>
Sourcepub fn new(metadata: Option<Metadata>, vocab: V, storage: S) -> Self
👎Deprecated: rust2vec is superseded by the finalfusion crate
pub fn new(metadata: Option<Metadata>, vocab: V, storage: S) -> Self
Construct an embeddings from a vocabulary and storage.
Sourcepub fn into_parts(self) -> (Option<Metadata>, V, S)
👎Deprecated: rust2vec is superseded by the finalfusion crate
pub fn into_parts(self) -> (Option<Metadata>, V, S)
Decompose embeddings in its vocabulary and storage.
Sourcepub fn metadata(&self) -> Option<&Metadata>
👎Deprecated: rust2vec is superseded by the finalfusion crate
pub fn metadata(&self) -> Option<&Metadata>
Get metadata.
Sourcepub fn metadata_mut(&mut self) -> Option<&mut Metadata>
👎Deprecated: rust2vec is superseded by the finalfusion crate
pub fn metadata_mut(&mut self) -> Option<&mut Metadata>
Get metadata mutably.
Sourcepub fn set_metadata(&mut self, metadata: Option<Metadata>) -> Option<Metadata>
👎Deprecated: rust2vec is superseded by the finalfusion crate
pub fn set_metadata(&mut self, metadata: Option<Metadata>) -> Option<Metadata>
Set metadata.
Returns the previously-stored metadata.
Source§impl<V, S> Embeddings<V, S>
impl<V, S> Embeddings<V, S>
Sourcepub fn dims(&self) -> usize
👎Deprecated: rust2vec is superseded by the finalfusion crate
pub fn dims(&self) -> usize
Return the length (in vector components) of the word embeddings.
Sourcepub fn embedding(&self, word: &str) -> Option<CowArray1<'_, f32>>
👎Deprecated: rust2vec is superseded by the finalfusion crate
pub fn embedding(&self, word: &str) -> Option<CowArray1<'_, f32>>
Get the embedding of a word.
Trait Implementations§
Source§impl<V, S> Analogy for Embeddings<V, S>where
V: Vocab,
S: StorageView,
impl<V, S> Analogy for Embeddings<V, S>where
V: Vocab,
S: StorageView,
Source§impl<V, S> AnalogyBy for Embeddings<V, S>where
V: Vocab,
S: StorageView,
impl<V, S> AnalogyBy for Embeddings<V, S>where
V: Vocab,
S: StorageView,
Source§impl From<Embeddings<SimpleVocab, MmapArray>> for Embeddings<VocabWrap, StorageViewWrap>
impl From<Embeddings<SimpleVocab, MmapArray>> for Embeddings<VocabWrap, StorageViewWrap>
Source§fn from(from: Embeddings<SimpleVocab, MmapArray>) -> Self
fn from(from: Embeddings<SimpleVocab, MmapArray>) -> Self
Converts to this type from the input type.
Source§impl From<Embeddings<SimpleVocab, MmapArray>> for Embeddings<VocabWrap, StorageWrap>
impl From<Embeddings<SimpleVocab, MmapArray>> for Embeddings<VocabWrap, StorageWrap>
Source§fn from(from: Embeddings<SimpleVocab, MmapArray>) -> Self
fn from(from: Embeddings<SimpleVocab, MmapArray>) -> Self
Converts to this type from the input type.
Source§impl From<Embeddings<SimpleVocab, NdArray>> for Embeddings<VocabWrap, StorageViewWrap>
impl From<Embeddings<SimpleVocab, NdArray>> for Embeddings<VocabWrap, StorageViewWrap>
Source§fn from(from: Embeddings<SimpleVocab, NdArray>) -> Self
fn from(from: Embeddings<SimpleVocab, NdArray>) -> Self
Converts to this type from the input type.
Source§impl From<Embeddings<SimpleVocab, NdArray>> for Embeddings<VocabWrap, StorageWrap>
impl From<Embeddings<SimpleVocab, NdArray>> for Embeddings<VocabWrap, StorageWrap>
Source§fn from(from: Embeddings<SimpleVocab, NdArray>) -> Self
fn from(from: Embeddings<SimpleVocab, NdArray>) -> Self
Converts to this type from the input type.
Source§impl From<Embeddings<SimpleVocab, QuantizedArray>> for Embeddings<VocabWrap, StorageWrap>
impl From<Embeddings<SimpleVocab, QuantizedArray>> for Embeddings<VocabWrap, StorageWrap>
Source§fn from(from: Embeddings<SimpleVocab, QuantizedArray>) -> Self
fn from(from: Embeddings<SimpleVocab, QuantizedArray>) -> Self
Converts to this type from the input type.
Source§impl From<Embeddings<SubwordVocab, MmapArray>> for Embeddings<VocabWrap, StorageViewWrap>
impl From<Embeddings<SubwordVocab, MmapArray>> for Embeddings<VocabWrap, StorageViewWrap>
Source§fn from(from: Embeddings<SubwordVocab, MmapArray>) -> Self
fn from(from: Embeddings<SubwordVocab, MmapArray>) -> Self
Converts to this type from the input type.
Source§impl From<Embeddings<SubwordVocab, MmapArray>> for Embeddings<VocabWrap, StorageWrap>
impl From<Embeddings<SubwordVocab, MmapArray>> for Embeddings<VocabWrap, StorageWrap>
Source§fn from(from: Embeddings<SubwordVocab, MmapArray>) -> Self
fn from(from: Embeddings<SubwordVocab, MmapArray>) -> Self
Converts to this type from the input type.
Source§impl From<Embeddings<SubwordVocab, NdArray>> for Embeddings<VocabWrap, StorageViewWrap>
impl From<Embeddings<SubwordVocab, NdArray>> for Embeddings<VocabWrap, StorageViewWrap>
Source§fn from(from: Embeddings<SubwordVocab, NdArray>) -> Self
fn from(from: Embeddings<SubwordVocab, NdArray>) -> Self
Converts to this type from the input type.
Source§impl From<Embeddings<SubwordVocab, NdArray>> for Embeddings<VocabWrap, StorageWrap>
impl From<Embeddings<SubwordVocab, NdArray>> for Embeddings<VocabWrap, StorageWrap>
Source§fn from(from: Embeddings<SubwordVocab, NdArray>) -> Self
fn from(from: Embeddings<SubwordVocab, NdArray>) -> Self
Converts to this type from the input type.
Source§impl From<Embeddings<SubwordVocab, QuantizedArray>> for Embeddings<VocabWrap, StorageWrap>
impl From<Embeddings<SubwordVocab, QuantizedArray>> for Embeddings<VocabWrap, StorageWrap>
Source§fn from(from: Embeddings<SubwordVocab, QuantizedArray>) -> Self
fn from(from: Embeddings<SubwordVocab, QuantizedArray>) -> Self
Converts to this type from the input type.
Source§impl<'a, V, S> IntoIterator for &'a Embeddings<V, S>
impl<'a, V, S> IntoIterator for &'a Embeddings<V, S>
Source§impl<V, S> MmapEmbeddings for Embeddings<V, S>where
Self: Sized,
V: ReadChunk,
S: MmapChunk,
impl<V, S> MmapEmbeddings for Embeddings<V, S>where
Self: Sized,
V: ReadChunk,
S: MmapChunk,
Source§impl<V, S> ReadEmbeddings for Embeddings<V, S>where
V: ReadChunk,
S: ReadChunk,
impl<V, S> ReadEmbeddings for Embeddings<V, S>where
V: ReadChunk,
S: ReadChunk,
Source§impl<R> ReadText<R> for Embeddings<SimpleVocab, NdArray>where
R: BufRead,
impl<R> ReadText<R> for Embeddings<SimpleVocab, NdArray>where
R: BufRead,
Source§impl<R> ReadTextDims<R> for Embeddings<SimpleVocab, NdArray>where
R: BufRead,
impl<R> ReadTextDims<R> for Embeddings<SimpleVocab, NdArray>where
R: BufRead,
Source§impl<R> ReadWord2Vec<R> for Embeddings<SimpleVocab, NdArray>where
R: BufRead,
impl<R> ReadWord2Vec<R> for Embeddings<SimpleVocab, NdArray>where
R: BufRead,
Source§impl<V, S> Similarity for Embeddings<V, S>where
V: Vocab,
S: StorageView,
impl<V, S> Similarity for Embeddings<V, S>where
V: Vocab,
S: StorageView,
Source§fn similarity(
&self,
word: &str,
limit: usize,
) -> Option<Vec<WordSimilarity<'_>>>
fn similarity( &self, word: &str, limit: usize, ) -> Option<Vec<WordSimilarity<'_>>>
Find words that are similar to the query word. Read more
Source§impl<V, S> SimilarityBy for Embeddings<V, S>where
V: Vocab,
S: StorageView,
impl<V, S> SimilarityBy for Embeddings<V, S>where
V: Vocab,
S: StorageView,
Source§fn similarity_by<F>(
&self,
word: &str,
limit: usize,
similarity: F,
) -> Option<Vec<WordSimilarity<'_>>>
fn similarity_by<F>( &self, word: &str, limit: usize, similarity: F, ) -> Option<Vec<WordSimilarity<'_>>>
Find words that are similar to the query word using the given similarity
function. Read more
Source§impl<V, S> WriteEmbeddings for Embeddings<V, S>where
V: WriteChunk,
S: WriteChunk,
impl<V, S> WriteEmbeddings for Embeddings<V, S>where
V: WriteChunk,
S: WriteChunk,
Source§impl<W, V, S> WriteText<W> for Embeddings<V, S>
impl<W, V, S> WriteText<W> for Embeddings<V, S>
Source§impl<W, V, S> WriteTextDims<W> for Embeddings<V, S>
impl<W, V, S> WriteTextDims<W> for Embeddings<V, S>
Source§impl<W, V, S> WriteWord2Vec<W> for Embeddings<V, S>
impl<W, V, S> WriteWord2Vec<W> for Embeddings<V, S>
Auto Trait Implementations§
impl<V, S> Freeze for Embeddings<V, S>
impl<V, S> RefUnwindSafe for Embeddings<V, S>where
S: RefUnwindSafe,
V: RefUnwindSafe,
impl<V, S> Send for Embeddings<V, S>
impl<V, S> Sync for Embeddings<V, S>
impl<V, S> Unpin for Embeddings<V, S>
impl<V, S> UnwindSafe for Embeddings<V, S>where
S: UnwindSafe,
V: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more