'config' 未定义 Pocketsphinx Python
'config' is not defined Pocketsphinx Python
我已经导入了模块:
from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *
LiveSpeech 模块正在运行,我正在尝试使用以下方法禁用日志:
config.set_string('-logfn', '/dev/null')
尽管我收到以下错误:
Traceback (most recent call last): File "/home/pi/Downloads/Test.py", line 23, in config.set_string('-logfn', '/dev/null')
NameError: name 'config' is not defined**
您需要像这样创建配置:
config = Decoder.default_config()
config.set_string('-logfn', '/dev/null')
decoder = Decoder(config)
我已经导入了模块:
from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *
LiveSpeech 模块正在运行,我正在尝试使用以下方法禁用日志:
config.set_string('-logfn', '/dev/null')
尽管我收到以下错误:
Traceback (most recent call last): File "/home/pi/Downloads/Test.py", line 23, in config.set_string('-logfn', '/dev/null')
NameError: name 'config' is not defined**
您需要像这样创建配置:
config = Decoder.default_config()
config.set_string('-logfn', '/dev/null')
decoder = Decoder(config)