Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async loadTokenizer() {
return use.loadTokenizer();
}
async train() {
const promises = [];
if (!model) promises.push(load());
else promises.push(Promise.resolve(model));
if (!tokenizer) promises.push(loadTokenizer());
else promises.push(Promise.resolve(tokenizer));
const USE = await Promise.all(promises);
if (!model) model = USE[ 0 ];
if (!tokenizer) tokenizer = USE[ 1 ];
this.model = model;
this.tokenizer = tokenizer;
return this.model;
}
/**
async train() {
const promises = [];
if (!model) promises.push(UniversalSentenceEncoder.load());
else promises.push(Promise.resolve(model));
if (!tokenizer) promises.push(UniversalSentenceEncoder.loadTokenizer());
else promises.push(Promise.resolve(tokenizer));
const USE = await Promise.all(promises);
if (!model) model = USE[ 0 ];
if (!tokenizer) tokenizer = USE[ 1 ];
this.model = model;
this.tokenizer = tokenizer;
return this.model;
}
/**