Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Skip languages already loaded
  • Loading branch information
Balearica committed Oct 4, 2023
1 parent 02ec948 commit 9954791
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/createWorker.js
Expand Up @@ -162,10 +162,14 @@ module.exports = async (langs = 'eng', oem = OEM.LSTM_ONLY, _options = {}, confi
// and this can be avoided entirely if the user loads the correct data ahead of time.
const langsArr = typeof langs === 'string' ? langs.split('+') : langs;
const _langs = langsArr.filter((x) => !currentLangs.includes(x));
currentLangs.push(_langs);
currentLangs.push(..._langs);

return loadLanguageInternal(_langs, jobId)
.then(() => initializeInternal(langs, _oem, _config, jobId));
if (_langs.length > 0) {
return loadLanguageInternal(_langs, jobId)
.then(() => initializeInternal(langs, _oem, _config, jobId));
}

return initializeInternal(langs, _oem, _config, jobId);
};

const setParameters = (params = {}, jobId) => (
Expand Down

0 comments on commit 9954791

Please sign in to comment.