Expand description
Reader and writer for the word2vec binary format.
Embeddings in the word2vec binary format are these formats are read as follows:
use std::fs::File;
use std::io::BufReader;
use rust2vec::prelude::*;
let mut reader = BufReader::new(File::open("testdata/similarity.bin").unwrap());
// Read the embeddings. The second arguments specifies whether
// the embeddings should be normalized to unit vectors.
let embeddings = Embeddings::read_word2vec_binary(&mut reader, true)
.unwrap();
// Look up an embedding.
let embedding = embeddings.embedding("Berlin");Traitsยง
- Read
Word2 Vec - Method to construct
Embeddingsfrom a word2vec binary file. - Write
Word2 Vec - Method to write
Embeddingsto a word2vec binary file.