0

我正在尝试将 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(最近一次通话最后一次):文件“./main.py”,第 3 行,从 pocketsphinx 导入 LiveSpeech ImportError:无法导入名称 LiveSpeech

注意:我已经从CMU Sphinx成功安装了 pocketsphinx

4

1 回答 1

0

我有一个旧版本的pocketsphinx。确保安装了最新版本。

# Make sure we have up-to-date versions of pip, setuptools and wheel:
$ pip install --upgrade pip setuptools wheel

$ pip install --upgrade pocketsphinx
于 2021-03-09T08:16:51.950 回答