[][src]Struct rust2vec::embeddings::Embeddings

pub struct Embeddings<V, S> { /* fields omitted */ }
Deprecated:

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]

Deprecated:

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]

Deprecated:

rust2vec is superseded by the finalfusion crate

Decompose embeddings in its vocabulary and storage.

pub fn metadata(&self) -> Option<&Metadata>[src]

Deprecated:

rust2vec is superseded by the finalfusion crate

Get metadata.

pub fn metadata_mut(&mut self) -> Option<&mut Metadata>[src]

Deprecated:

rust2vec is superseded by the finalfusion crate

Get metadata mutably.

pub fn set_metadata(&mut self, metadata: Option<Metadata>) -> Option<Metadata>[src]

Deprecated:

rust2vec is superseded by the finalfusion crate

Set metadata.

Returns the previously-stored metadata.

pub fn storage(&self) -> &S[src]

Deprecated:

rust2vec is superseded by the finalfusion crate

Get the embedding storage.

pub fn vocab(&self) -> &V[src]

Deprecated:

rust2vec is superseded by the finalfusion crate

Get the vocabulary.

impl<V, S> Embeddings<V, S> where
    V: Vocab,
    S: Storage
[src]

pub fn dims(&self) -> usize[src]

Deprecated:

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]

Deprecated:

rust2vec is superseded by the finalfusion crate

Get the embedding of a word.

Important traits for Iter<'a>
pub fn iter(&self) -> Iter[src]

Deprecated:

rust2vec is superseded by the finalfusion crate

Get an iterator over pairs of words and the corresponding embeddings.

pub fn len(&self) -> usize[src]

Deprecated:

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]

impl<V, S> MmapEmbeddings for Embeddings<V, S> where
    Self: Sized,
    V: ReadChunk,
    S: MmapChunk, 
[src]

impl<V, S> WriteEmbeddings for Embeddings<V, S> where
    V: WriteChunk,
    S: WriteChunk, 
[src]

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

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

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

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

impl<R> ReadText<R> for Embeddings<SimpleVocab, NdArray> where
    R: BufRead
[src]

impl<R> ReadTextDims<R> for Embeddings<SimpleVocab, NdArray> where
    R: BufRead
[src]

impl<W, V, S> WriteText<W> for Embeddings<V, S> where
    W: Write,
    V: Vocab,
    S: Storage
[src]

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]

impl<R> ReadWord2Vec<R> for Embeddings<SimpleVocab, NdArray> where
    R: BufRead
[src]

impl<W, V, S> WriteWord2Vec<W> for Embeddings<V, S> where
    W: Write,
    V: Vocab,
    S: Storage
[src]

impl<'a, V, S> IntoIterator for &'a Embeddings<V, S> where
    V: Vocab,
    S: Storage
[src]

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?

impl From<Embeddings<SimpleVocab, NdArray>> for Embeddings<VocabWrap, StorageWrap>[src]

impl From<Embeddings<SimpleVocab, NdArray>> for Embeddings<VocabWrap, StorageViewWrap>[src]

impl From<Embeddings<SimpleVocab, MmapArray>> for Embeddings<VocabWrap, StorageWrap>[src]

impl From<Embeddings<SimpleVocab, MmapArray>> for Embeddings<VocabWrap, StorageViewWrap>[src]

impl From<Embeddings<SimpleVocab, QuantizedArray>> for Embeddings<VocabWrap, StorageWrap>[src]

impl From<Embeddings<SubwordVocab, NdArray>> for Embeddings<VocabWrap, StorageWrap>[src]

impl From<Embeddings<SubwordVocab, NdArray>> for Embeddings<VocabWrap, StorageViewWrap>[src]

impl From<Embeddings<SubwordVocab, MmapArray>> for Embeddings<VocabWrap, StorageWrap>[src]

impl From<Embeddings<SubwordVocab, MmapArray>> for Embeddings<VocabWrap, StorageViewWrap>[src]

impl From<Embeddings<SubwordVocab, QuantizedArray>> for Embeddings<VocabWrap, StorageWrap>[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

impl<V, S> Sync for Embeddings<V, S> where
    S: Sync,
    V: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.