diff --git a/neon_stt_plugin_nemo/__init__.py b/neon_stt_plugin_nemo/__init__.py index 2c0484c..47534e8 100644 --- a/neon_stt_plugin_nemo/__init__.py +++ b/neon_stt_plugin_nemo/__init__.py @@ -45,18 +45,22 @@ def __init__(self, config: dict = None): self._engines = {} self.cache_engines = self.config.get("cache", True) + self.default_model = self.config.get("model", None) if self.cache_engines: - self._init_model(self.lang) + self._init_model() - def _init_model(self, language) -> Model: + def _init_model(self, language=None) -> Model: # OVOS uses 'en-us' so this hacks that to work until dialects are supported - language = (language or self.lang).split('-')[0] - if language not in self._engines: - model = Model(language) + lang = (language or self.lang).split('-')[0] + if lang not in self._engines: + if self.default_model and language is None: + model = Model(lang=lang, model_folder=self.default_model) + else: + model = Model(lang=lang) if self.cache_engines: - self._engines[language] = model + self._engines[lang] = model else: - model = self._engines[language] + model = self._engines[lang] return model diff --git a/requirements/requirements.txt b/requirements/requirements.txt index a7f0868..c5a6db6 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,4 +1,4 @@ ovos-plugin-manager~=0.0.24 ovos-utils~=0.0,>=0.0.30 -streaming-stt-nemo~=0.2 +streaming-stt-nemo~=0.2,>=0.2.1a0 SpeechRecognition~=3.8