How to fix: ImportError: cannot import name LiveSpeech?
How to fix: ImportError: cannot import name LiveSpeech?
我正在尝试将 LiveSpeech 与我训练过的模型和字典一起使用:
#!/usr/bin/env python
from pocketsphinx import LiveSpeech
hmm = '/home/ridwan/sphinx/other1/output/other1.ci_cont' #folder of the acoustic model
lm = '/home/ridwan/sphinx/other1/output/other1.lm.DMP' #language model
dict = '/home/ridwan/sphinx/other1/output/other1.dic' #the phonetic dictionary
recognizer = LiveSpeech (verbose = False, sampling_rate = 16000, buffer_size = 2048,
no_search = False, full_utt = False,
hmm = hmm, lm = lm, dic = dict)
for phrase in recognizer:
print (phrase)
但我收到以下错误:
Traceback (most recent call last):
File "./main.py", line 3, in
from pocketsphinx import LiveSpeech
ImportError: cannot import name LiveSpeech
注意: 我已经从 CMU Sphinx
成功安装了 pocketsphinx
我有一个旧版本的 pocketsphinx。
确保已安装 latest。
# Make sure we have up-to-date versions of pip, setuptools and wheel:
$ pip install --upgrade pip setuptools wheel
$ pip install --upgrade pocketsphinx
我正在尝试将 LiveSpeech 与我训练过的模型和字典一起使用:
#!/usr/bin/env python
from pocketsphinx import LiveSpeech
hmm = '/home/ridwan/sphinx/other1/output/other1.ci_cont' #folder of the acoustic model
lm = '/home/ridwan/sphinx/other1/output/other1.lm.DMP' #language model
dict = '/home/ridwan/sphinx/other1/output/other1.dic' #the phonetic dictionary
recognizer = LiveSpeech (verbose = False, sampling_rate = 16000, buffer_size = 2048,
no_search = False, full_utt = False,
hmm = hmm, lm = lm, dic = dict)
for phrase in recognizer:
print (phrase)
但我收到以下错误:
Traceback (most recent call last): File "./main.py", line 3, in from pocketsphinx import LiveSpeech ImportError: cannot import name LiveSpeech
注意: 我已经从 CMU Sphinx
成功安装了 pocketsphinx我有一个旧版本的 pocketsphinx。 确保已安装 latest。
# Make sure we have up-to-date versions of pip, setuptools and wheel:
$ pip install --upgrade pip setuptools wheel
$ pip install --upgrade pocketsphinx