1
0
mirror of https://github.com/aidygus/LinVAM.git synced 2024-11-27 11:08:06 +11:00

Fix pocketsphinx import. Update deprecated Decoder config

This commit is contained in:
smirgol 2023-06-27 12:26:37 +02:00
parent a229683c57
commit 32d30656c4

View File

@ -5,8 +5,7 @@ import threading
import os, pyaudio import os, pyaudio
import shutil import shutil
import re import re
from pocketsphinx.pocketsphinx import * from pocketsphinx import *
from sphinxbase.sphinxbase import *
from soundfiles import SoundFiles from soundfiles import SoundFiles
@ -22,12 +21,12 @@ class ProfileExecutor(threading.Thread):
self.m_listening = False self.m_listening = False
self.m_cmdThreads = {} self.m_cmdThreads = {}
self.m_config = Decoder.default_config() self.m_config = Config(
self.m_config.set_string('-hmm', os.path.join('model', 'en-us/en-us')) hmm=os.path.join('model', 'en-us/en-us'),
self.m_config.set_string('-dict', os.path.join('model', 'en-us/cmudict-en-us.dict')) dict=os.path.join('model', 'en-us/cmudict-en-us.dict'),
self.m_config.set_string('-kws', 'command.list') kws='command.list',
# you usually don't want all this info stuff as a regular user. it just covers up init messages logfn='/dev/null'
self.m_config.set_string('-logfn', '/dev/null') )
self.m_pyaudio = pyaudio.PyAudio() self.m_pyaudio = pyaudio.PyAudio()
self.m_stream = self.m_pyaudio.open(format=pyaudio.paInt16, channels=1, rate=16000, input=True) self.m_stream = self.m_pyaudio.open(format=pyaudio.paInt16, channels=1, rate=16000, input=True)