https://github.com/dimakudosh/word2vec
Rust interface to word2vec.
https://github.com/dimakudosh/word2vec
rust word2vec
Last synced: about 1 year ago
JSON representation
Rust interface to word2vec.
- Host: GitHub
- URL: https://github.com/dimakudosh/word2vec
- Owner: DimaKudosh
- License: mit
- Created: 2016-01-28T19:57:43.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2019-11-04T15:30:36.000Z (over 6 years ago)
- Last Synced: 2025-03-30T11:01:40.694Z (over 1 year ago)
- Topics: rust, word2vec
- Language: Rust
- Homepage:
- Size: 50 MB
- Stars: 29
- Watchers: 1
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.rst
- License: LICENSE
Awesome Lists containing this project
README
# word2vec [](https://travis-ci.org/DimaKudosh/word2vec)
Rust interface to word2vec word vectors.
This crate provides a way to read a trained word vector file from word2vec.
It doesn't provide model training and hence requires a already trained model.
## Documentation
Documentation is available at https://github.com/DimaKudosh/word2vec/wiki
## Example
Add this to your `cargo.toml`:
```
[dependencies]
# …
word2vec = "0.3.3"
```
Example for word similarity and word clusters:
```rust
extern crate word2vec;
fn main(){
let model = word2vec::wordvectors::WordVector::load_from_binary(
"vectors.bin").expect("Unable to load word vector model");
println!("{:?}", model.cosine("snow", 10));
let positive = vec!["woman", "king"];
let negative = vec!["man"];
println!("{:?}", model.analogy(positive, negative, 10));
let clusters = word2vec::wordclusters::WordClusters::load_from_file(
"classes.txt").expect("Unable to load word clusters");
println!("{:?}", clusters.get_cluster("belarus"));
println!("{:?}", clusters.get_words_on_cluster(6));
}
```