Skip to content

Commit 4e6f798

Browse files
committed
update word2vec
1 parent 27b1759 commit 4e6f798

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/Word2vec/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ Word2Vec
1010
import * as tf from '@tensorflow/tfjs';
1111

1212
class Word2Vec {
13-
constructor(vectors, callback) {
13+
constructor(model, callback) {
1414
this.ready = false;
1515
this.model = {};
1616
this.modelSize = 0;
17-
this.loadVectors(vectors, callback);
17+
this.loadModel(model, callback);
1818
}
1919

20-
loadVectors(file, callback) {
20+
loadModel(file, callback) {
2121
fetch(file)
2222
.then(response => response.json())
2323
.then((json) => {
@@ -105,4 +105,6 @@ class Word2Vec {
105105
}
106106
}
107107

108-
export default Word2Vec;
108+
const word2vec = (model, cb = () => {}) => new Word2Vec(model, cb);
109+
110+
export default word2vec;

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as tf from '@tensorflow/tfjs';
77
import pitchDetection from './PitchDetection/';
88
import imageClassifier from './ImageClassifier/';
99
import featureExtractor from './FeatureExtractor/';
10-
import Word2Vec from './Word2vec/';
10+
import word2vec from './Word2vec/';
1111
import YOLO from './YOLO';
1212
import poseNet from './PoseNet';
1313
import * as imageUtils from './utils/imageUtilities';
@@ -19,7 +19,7 @@ module.exports = {
1919
featureExtractor,
2020
pitchDetection,
2121
YOLO,
22-
Word2Vec,
22+
word2vec,
2323
styleTransfer,
2424
poseNet,
2525
LSTMGenerator,

0 commit comments

Comments
 (0)