commit
2dab08f483
|
@ -20,7 +20,7 @@ import os
|
|||
import tempfile
|
||||
import time
|
||||
|
||||
from os.path import join, dirname, abspath
|
||||
from os.path import join, dirname, abspath, exists
|
||||
from pocketsphinx import Decoder
|
||||
|
||||
from mycroft.client.speech.recognizer.local_recognizer import LocalRecognizer
|
||||
|
@ -52,7 +52,12 @@ class PocketsphinxRecognizer(LocalRecognizer):
|
|||
|
||||
def create_config(self, dict_name):
|
||||
config = Decoder.default_config()
|
||||
config.set_string('-hmm', join(BASEDIR, 'model', self.lang, 'hmm'))
|
||||
model_file = join(BASEDIR, 'model', self.lang, 'hmm')
|
||||
if not exists(model_file):
|
||||
LOG.error('PocketSphinx model not found for {}', self.lang)
|
||||
model_file = join(BASEDIR, 'model', 'en-us', 'hmm')
|
||||
|
||||
config.set_string('-hmm', model_file)
|
||||
config.set_string('-dict', dict_name)
|
||||
config.set_string('-keyphrase', self.key_phrase)
|
||||
config.set_float('-kws_threshold', float(self.threshold))
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
|
||||
import pystache
|
||||
from io import open
|
||||
import os
|
||||
import random
|
||||
from mycroft.util import log, resolve_resource_file
|
||||
|
|
|
@ -167,5 +167,5 @@ KEY_MAP = {
|
|||
def create(lang):
|
||||
clazz = KEY_MAP.get(lang)
|
||||
if not clazz:
|
||||
clazz = TimeRulesEnUs()
|
||||
clazz = TimeRulesEnUs
|
||||
return clazz()
|
||||
|
|
Loading…
Reference in New Issue