word2vec-loader-js
v1.1.4
Published
Small word2vec model
Downloads
19
Readme
Word2Vec-loader-js
const w2v = require ('word2vec-loader-js')
w2v.loadModel('/home/user/word2vec.txt').then(model => {
console.log(model.cosineSimilarity('hello', 'bye'))
console.log(model.getVectorOf('dance'))
}).catch(err => {
console.error(err)
})
Install
npm install word2vec-loader-js --local
API
w2v
.loadModel
w2v.loadModel(filePah: String): Promise<Word2VecModel>
.sub
w2v.sub(vectorA: Array<Number>, vectorB : Array<Number>) : Array<Number>
.sum
w2v.sum(vectorA: Array<Number>, vectorB : Array<Number>) : Array<Number>
.cosineSimilarityNormalizedVecs
w2v.cosineSimilarityNormalizedVecs(vectorA: Array<Number>, vectorB : Array<Number>) : Number
.cosineSimilarity
w2v.cosineSimilarity(vectorA: Array<Number>, vectorB : Array<Number>) : Number
.vecDotProduct
w2v.vecDotProduct(vectorA: Array<Number>, vectorB : Array<Number>) : Number
.vecMagnitude
w2v.vecMagnitude(vec: Array<Number>) : Number
.norm
w2v.norm(vec: Array<Number>) : Array<Number>
.normalize
w2v.normalize(vec: Array<Number>) : Array<Number>
Word2VecModel
.getVectorOf
model.getVectorOf(word : String) : Array<Number>
.addWord
model.addWord(word : String, vector : Array<Number>) : void
.removeWord
model.removeWord(word : String) : void
.getWords
model.getWords() : Array<String>
.cosineSimilarity
model.cosineSimilarity(wordA: String, wordB : String) : Number
.cosineSimilarityNormalizedVecs
model.cosineSimilarityNormalizedVecs(wordA: String, wordB : String) : Number
.getMax
model.getMax(word: String) : Number
.getMin
model.getMin(word: String) : Number