Struct word2vec::wordvectors::WordVector
[−]
[src]
pub struct WordVector { /* fields omitted */ }
Representation of a word vector space
Each word of a vocabulary is represented by a vector. All words span a vector space. This data structure manages this vector space of words.
Methods
impl WordVector
[src]
fn load_from_binary(file_name: &str) -> Result<WordVector, Word2VecError>
[src]
Load a word vector space from file
Word2vec is able to store the word vectors in a binary file. This function parses the file and loads the vectors into RAM.
fn get_vector(&self, word: &str) -> Option<&Vec<f32>>
[src]
Get word vector for the given word.
fn cosine(&self, word: &str, n: usize) -> Option<Vec<(String, f32)>>
[src]
Compute consine distance to similar words.
The words in the vector space are characterized through the position and angle to each
other. This method calculates the n
closest words via the cosine of the requested word to
all other words.
fn analogy(
&self,
pos: Vec<&str>,
neg: Vec<&str>,
n: usize
) -> Option<Vec<(String, f32)>>
[src]
&self,
pos: Vec<&str>,
neg: Vec<&str>,
n: usize
) -> Option<Vec<(String, f32)>>
fn word_count(&self) -> usize
[src]
Get the number of all known words from the vocabulary.
fn get_col_count(&self) -> usize
[src]
Return the number of columns of the word vector.
fn get_words<'a>(&'a self) -> Words<'a>
[src]
Get all known words from the vocabulary.