[−][src]Struct rust2vec::embeddings::Embeddings
rust2vec is superseded by the finalfusion crate
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.
Methods
impl<V, S> Embeddings<V, S>
[src]
pub fn new(metadata: Option<Metadata>, vocab: V, storage: S) -> Self
[src]
rust2vec is superseded by the finalfusion crate
Construct an embeddings from a vocabulary and storage.
pub fn into_parts(self) -> (Option<Metadata>, V, S)
[src]
rust2vec is superseded by the finalfusion crate
Decompose embeddings in its vocabulary and storage.
pub fn metadata(&self) -> Option<&Metadata>
[src]
rust2vec is superseded by the finalfusion crate
Get metadata.
pub fn metadata_mut(&mut self) -> Option<&mut Metadata>
[src]
rust2vec is superseded by the finalfusion crate
Get metadata mutably.
pub fn set_metadata(&mut self, metadata: Option<Metadata>) -> Option<Metadata>
[src]
rust2vec is superseded by the finalfusion crate
Set metadata.
Returns the previously-stored metadata.
pub fn storage(&self) -> &S
[src]
rust2vec is superseded by the finalfusion crate
Get the embedding storage.
pub fn vocab(&self) -> &V
[src]
rust2vec is superseded by the finalfusion crate
Get the vocabulary.
impl<V, S> Embeddings<V, S> where
V: Vocab,
S: Storage,
[src]
V: Vocab,
S: Storage,
pub fn dims(&self) -> usize
[src]
rust2vec is superseded by the finalfusion crate
Return the length (in vector components) of the word embeddings.
pub fn embedding(&self, word: &str) -> Option<CowArray1<f32>>
[src]
rust2vec is superseded by the finalfusion crate
Get the embedding of a word.
ⓘImportant traits for Iter<'a>pub fn iter(&self) -> Iter
[src]
rust2vec is superseded by the finalfusion crate
Get an iterator over pairs of words and the corresponding embeddings.
pub fn len(&self) -> usize
[src]
rust2vec is superseded by the finalfusion crate
Get the vocabulary size.
The vocabulary size excludes subword units.
Trait Implementations
impl<V, S> ReadEmbeddings for Embeddings<V, S> where
V: ReadChunk,
S: ReadChunk,
[src]
V: ReadChunk,
S: ReadChunk,
impl<V, S> MmapEmbeddings for Embeddings<V, S> where
Self: Sized,
V: ReadChunk,
S: MmapChunk,
[src]
Self: Sized,
V: ReadChunk,
S: MmapChunk,
impl<V, S> WriteEmbeddings for Embeddings<V, S> where
V: WriteChunk,
S: WriteChunk,
[src]
V: WriteChunk,
S: WriteChunk,
impl<V, S> Analogy for Embeddings<V, S> where
V: Vocab,
S: StorageView,
[src]
V: Vocab,
S: StorageView,
fn analogy(
&self,
word1: &str,
word2: &str,
word3: &str,
limit: usize
) -> Option<Vec<WordSimilarity>>
[src]
&self,
word1: &str,
word2: &str,
word3: &str,
limit: usize
) -> Option<Vec<WordSimilarity>>
impl<V, S> AnalogyBy for Embeddings<V, S> where
V: Vocab,
S: StorageView,
[src]
V: Vocab,
S: StorageView,
fn analogy_by<F>(
&self,
word1: &str,
word2: &str,
word3: &str,
limit: usize,
similarity: F
) -> Option<Vec<WordSimilarity>> where
F: FnMut(ArrayView2<f32>, ArrayView1<f32>) -> Array1<f32>,
[src]
&self,
word1: &str,
word2: &str,
word3: &str,
limit: usize,
similarity: F
) -> Option<Vec<WordSimilarity>> where
F: FnMut(ArrayView2<f32>, ArrayView1<f32>) -> Array1<f32>,
impl<V, S> Similarity for Embeddings<V, S> where
V: Vocab,
S: StorageView,
[src]
V: Vocab,
S: StorageView,
fn similarity(&self, word: &str, limit: usize) -> Option<Vec<WordSimilarity>>
[src]
impl<V, S> SimilarityBy for Embeddings<V, S> where
V: Vocab,
S: StorageView,
[src]
V: Vocab,
S: StorageView,
fn similarity_by<F>(
&self,
word: &str,
limit: usize,
similarity: F
) -> Option<Vec<WordSimilarity>> where
F: FnMut(ArrayView2<f32>, ArrayView1<f32>) -> Array1<f32>,
[src]
&self,
word: &str,
limit: usize,
similarity: F
) -> Option<Vec<WordSimilarity>> where
F: FnMut(ArrayView2<f32>, ArrayView1<f32>) -> Array1<f32>,
impl<R> ReadText<R> for Embeddings<SimpleVocab, NdArray> where
R: BufRead,
[src]
R: BufRead,
impl<R> ReadTextDims<R> for Embeddings<SimpleVocab, NdArray> where
R: BufRead,
[src]
R: BufRead,
impl<W, V, S> WriteText<W> for Embeddings<V, S> where
W: Write,
V: Vocab,
S: Storage,
[src]
W: Write,
V: Vocab,
S: Storage,
fn write_text(&self, write: &mut W) -> Result<(), Error>
[src]
Write the embeddings to the given writer.
impl<W, V, S> WriteTextDims<W> for Embeddings<V, S> where
W: Write,
V: Vocab,
S: Storage,
[src]
W: Write,
V: Vocab,
S: Storage,
impl<R> ReadWord2Vec<R> for Embeddings<SimpleVocab, NdArray> where
R: BufRead,
[src]
R: BufRead,
impl<W, V, S> WriteWord2Vec<W> for Embeddings<V, S> where
W: Write,
V: Vocab,
S: Storage,
[src]
W: Write,
V: Vocab,
S: Storage,
impl<'a, V, S> IntoIterator for &'a Embeddings<V, S> where
V: Vocab,
S: Storage,
[src]
V: Vocab,
S: Storage,
type Item = (&'a str, CowArray1<'a, f32>)
The type of the elements being iterated over.
type IntoIter = Iter<'a>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl From<Embeddings<SimpleVocab, NdArray>> for Embeddings<VocabWrap, StorageWrap>
[src]
fn from(from: Embeddings<SimpleVocab, NdArray>) -> Self
[src]
impl From<Embeddings<SimpleVocab, NdArray>> for Embeddings<VocabWrap, StorageViewWrap>
[src]
fn from(from: Embeddings<SimpleVocab, NdArray>) -> Self
[src]
impl From<Embeddings<SimpleVocab, MmapArray>> for Embeddings<VocabWrap, StorageWrap>
[src]
fn from(from: Embeddings<SimpleVocab, MmapArray>) -> Self
[src]
impl From<Embeddings<SimpleVocab, MmapArray>> for Embeddings<VocabWrap, StorageViewWrap>
[src]
fn from(from: Embeddings<SimpleVocab, MmapArray>) -> Self
[src]
impl From<Embeddings<SimpleVocab, QuantizedArray>> for Embeddings<VocabWrap, StorageWrap>
[src]
fn from(from: Embeddings<SimpleVocab, QuantizedArray>) -> Self
[src]
impl From<Embeddings<SubwordVocab, NdArray>> for Embeddings<VocabWrap, StorageWrap>
[src]
fn from(from: Embeddings<SubwordVocab, NdArray>) -> Self
[src]
impl From<Embeddings<SubwordVocab, NdArray>> for Embeddings<VocabWrap, StorageViewWrap>
[src]
fn from(from: Embeddings<SubwordVocab, NdArray>) -> Self
[src]
impl From<Embeddings<SubwordVocab, MmapArray>> for Embeddings<VocabWrap, StorageWrap>
[src]
fn from(from: Embeddings<SubwordVocab, MmapArray>) -> Self
[src]
impl From<Embeddings<SubwordVocab, MmapArray>> for Embeddings<VocabWrap, StorageViewWrap>
[src]
fn from(from: Embeddings<SubwordVocab, MmapArray>) -> Self
[src]
impl From<Embeddings<SubwordVocab, QuantizedArray>> for Embeddings<VocabWrap, StorageWrap>
[src]
fn from(from: Embeddings<SubwordVocab, QuantizedArray>) -> Self
[src]
impl<V: Debug, S: Debug> Debug for Embeddings<V, S>
[src]
Auto Trait Implementations
impl<V, S> Send for Embeddings<V, S> where
S: Send,
V: Send,
S: Send,
V: Send,
impl<V, S> Sync for Embeddings<V, S> where
S: Sync,
V: Sync,
S: Sync,
V: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,