Skip to content

Commit 6118397

Browse files
committed
changing vector->word in word2vec results
1 parent 8533ac3 commit 6118397

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)