[][src]Module finalfusion::word2vec

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 finalfusion::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

ReadWord2Vec

Method to construct Embeddings from a word2vec binary file.

WriteWord2Vec

Method to write Embeddings to a word2vec binary file.