https://github.com/binarymax/node-word2vec-native
Port of the word2vec distance program to a native node.js addon
https://github.com/binarymax/node-word2vec-native
word2vec word2vec-distance
Last synced: 6 months ago
JSON representation
Port of the word2vec distance program to a native node.js addon
- Host: GitHub
- URL: https://github.com/binarymax/node-word2vec-native
- Owner: binarymax
- License: apache-2.0
- Created: 2015-10-15T10:07:45.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-10-29T20:01:12.000Z (over 8 years ago)
- Last Synced: 2025-06-19T19:07:00.205Z (7 months ago)
- Topics: word2vec, word2vec-distance
- Language: C++
- Size: 10.7 KB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-word2vec-native
Port of the word2vec distance program to a native node.js addon
## Installation
Install it from npm
```npm install word2vec-native```
## Usage
This addon does not train vectors. You may use this to load an existing binary word2vec model file from disk. Once the model is loaded, you may perform the following two operations: get and compare.
```javascript
var distance = require('word2vec-native');
distance.open('my-word2vec-model.bin',function(err){
if(!err) {
console.log(distance.compare("foo","bar"));
console.log(distance.get("foo"));
}
});
```
### Get
Given a single term, returns a list of the most similar terms.
### Compare
Given two terms, returns the cosine distance between their respective vectors.
See the test.js code for an example
## Credit
Credit goes to Tomas Mikolov for his original word2vec implementation. Original code from https://code.google.com/p/word2vec/