本文整理汇总了Python中deepspeech.Model方法的典型用法代码示例。如果您正苦于以下问题:Python deepspeech.Model方法的具体用法?Python deepspeech.Model怎么用?Python deepspeech.Model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类deepspeech
的用法示例。
在下文中一共展示了deepspeech.Model方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import deepspeech [as 别名]
# 或者: from deepspeech import Model [as 别名]
def __init__(self):
super().__init__()
self._capableOfArbitraryCapture = True
self._isOnlineASR = False
self._langPath = Path(self.Commons.rootDir(), f'trained/asr/deepspeech/{self.LanguageManager.activeLanguage}')
self._model: Optional[deepspeech.Model] = None
self._triggerFlag = self.ThreadManager.newEvent('asrTriggerFlag')
self._vadTemporisation: Optional[threading.Timer] = None
示例2: __init__
# 需要导入模块: import deepspeech [as 别名]
# 或者: from deepspeech import Model [as 别名]
def __init__(self, path=DEFAULT_MODEL_PATH):
logger.info('Loading model from: {}...'.format(path))
self.model = Model(path, self.N_FEATURES, self.N_CONTEXT, self.alphabet_path, self.BEAM_WIDTH)
self.model.enableDecoderWithLM(self.alphabet_path, self.lm_path, self.trie_path, self.LM_ALPHA, self.LM_BETA)
logger.info('Loaded model')
示例3: onStart
# 需要导入模块: import deepspeech [as 别名]
# 或者: from deepspeech import Model [as 别名]
def onStart(self):
super().onStart()
if not self.checkLanguage():
self.downloadLanguage()
self._model = deepspeech.Model(f'{self._langPath}/deepspeech-0.6.1-models/output_graph.tflite', 500)
self._model.enableDecoderWithLM(f'{self._langPath}/deepspeech-0.6.1-models/lm.binary', f'{self._langPath}/deepspeech-0.6.1-models/trie', 0.75, 1.85)
示例4: _get_model
# 需要导入模块: import deepspeech [as 别名]
# 或者: from deepspeech import Model [as 别名]
def _get_model(self) -> deepspeech.Model:
if not self._model:
self._model = deepspeech.Model(self.model_file, self.beam_width)
self._model.enableDecoderWithLM(self.lm_file, self.trie_file, self.lm_alpha, self.lm_beta)
return self._model
示例5: __init__
# 需要导入模块: import deepspeech [as 别名]
# 或者: from deepspeech import Model [as 别名]
def __init__(self):
deepspeech_dir = os.path.join(os.path.dirname(__file__), 'resources/deepspeech')
model_path = os.path.join(deepspeech_dir, 'output_graph.pbmm')
alphabet_path = os.path.join(deepspeech_dir, 'alphabet.txt')
language_model_path = os.path.join(deepspeech_dir, 'lm.binary')
trie_path = os.path.join(deepspeech_dir, 'trie')
# https://github.com/mozilla/DeepSpeech/blob/master/native_client/python/client.py
self._model = Model(model_path, 500)
self._model.enableDecoderWithLM(language_model_path, trie_path, 0.75, 1.85)
示例6: init_stt
# 需要导入模块: import deepspeech [as 别名]
# 或者: from deepspeech import Model [as 别名]
def init_stt(output_graph_path, scorer_path):
global model
model = deepspeech.Model(output_graph_path)
model.enableExternalScorer(scorer_path)
logging.debug('Process {}: Loaded models'.format(os.getpid()))