Reputation: 11
ModuleNotFoundError: No module named 'pocketsphinx.pocketsphinx'; 'pocketsphinx' is not a package
import pyaudio as py
from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *
import glob
import os, sys
model=(r'C:\Users\ellag\AppData\Local\Programs\Python\Python36\Lib\site-packages\pocketsphinx\model')
config = Decoder_default_config()
config.set_string('-hmm', os.path.join(model, 'en-us\en-us'))
config.set_string('-dict', os.path.join(model, 'en-us\cmuict-en-us.dict'))
config.set_string('-kws', os.path.join(model, 'kws_file'))
decoder = Decoder(config)
p = py.PyAudio()
stream = p.open(format=py.paInt16,channels=1,rate=16000,input=True)
stream.start_stream()
While True:
buf=stream.read(1024)
Decoder.process_raw(buf, False, False)
if Decoder.hyp() != None:
print(seg.word, seg.prob)
letter=seg.word()
Upvotes: 1
Views: 1132
Reputation: 11
Try installing on terminal using:
sudo apt-get install pocketsphinx
Upvotes: 1