Skip to content

Commit bdcd950

Browse files
authored
Merge pull request #160 from ml5js/word2vec-api-change
Changing vector->word in word2vec results
2 parents 0a4a433 + 2b38e1c commit bdcd950

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Word2vec/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ class Word2Vec {
9696

9797
static nearest(model, input, start, max) {
9898
const nearestVectors = [];
99-
Object.keys(model).forEach((vector) => {
100-
const distance = tf.util.distSquared(input.dataSync(), model[vector].dataSync());
101-
nearestVectors.push({ vector, distance });
99+
Object.keys(model).forEach((word) => {
100+
const distance = tf.util.distSquared(input.dataSync(), model[word].dataSync());
101+
nearestVectors.push({ word, distance });
102102
});
103103
nearestVectors.sort((a, b) => a.distance - b.distance);
104104
return nearestVectors.slice(start, max);

0 commit comments

Comments
 (0)