We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0a4a433 commit 2b38e1cCopy full SHA for 2b38e1c
src/Word2vec/index.js
@@ -96,9 +96,9 @@ class Word2Vec {
96
97
static nearest(model, input, start, max) {
98
const nearestVectors = [];
99
- Object.keys(model).forEach((vector) => {
100
- const distance = tf.util.distSquared(input.dataSync(), model[vector].dataSync());
101
- nearestVectors.push({ vector, distance });
+ Object.keys(model).forEach((word) => {
+ const distance = tf.util.distSquared(input.dataSync(), model[word].dataSync());
+ nearestVectors.push({ word, distance });
102
});
103
nearestVectors.sort((a, b) => a.distance - b.distance);
104
return nearestVectors.slice(start, max);
0 commit comments