我有一个解决方案(jsgf, dict, hmm),可以很好的与
pocketsphinx_continuous -hmm zero_ru.cd_cont_4000 -dict vocabular.dict -jsgf calc.jsgf -inmic yes
现在我正试图将它移植到Pocketsphinx 0.1.15 (https:/pypi.orgprojectpocketsphinx。),并且我看到,在verbose输出中,Python pocketsphinx的配置和pocketsphinx_continuous的配置是不一样的。
结果Python pocketsphinx做了很多错误的phantom检测。
我的Python脚本非常简单。
speech = LiveSpeech(
verbose=True,
hmm='c:/Projects/pocketsphinx-5prealpha-win32/pocketsphinx/bin/Release/x64/zero_ru.cd_cont_4000',
lm=False,
jsgf='c:/Projects/pocketsphinx-5prealpha-win32/pocketsphinx/bin/Release/x64/calc.jsgf',
dic='c:/Projects/pocketsphinx-5prealpha-win32/pocketsphinx/bin/Release/x64/vocabular.dict',
allphone_ci=False,
vad_threshold=2.0,
kws_threshold=1.0,
)
for phrase in speech:
print(phrase)
通过比较文本文件和输出结果,我看到 pocketsphinx_continuous 的输出结果是:
INFO: fe_interface.c(325): Using -1 as the seed.
INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='current', VARNORM='no', AGC='none'
INFO: cmn.c(143): mean[0]= 12.00, mean[1..12]= 0.0
INFO: acmod.c(154): Reading linear feature transformation from zero_ru.cd_cont_4000/feature_transform
INFO: mdef.c(518): Reading model definition: zero_ru.cd_cont_4000/mdef
INFO: bin_mdef.c(181): Allocating 145321 * 8 bytes (1135 KiB) for CD tree
但Python pocketsphinx有
INFO: fe_interface.c(324): Using -1 as the seed.
INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='batch', VARNORM='no', AGC='none'
INFO: acmod.c(152): Reading linear feature transformation from c:/Projects/pocketsphinx-5prealpha-win32/pocketsphinx/bin/Release/x64/zero_ru.cd_cont_4000/feature_transform
INFO: mdef.c(518): Reading model definition: c:/Projects/pocketsphinx-5prealpha-win32/pocketsphinx/bin/Release/x64/zero_ru.cd_cont_4000/mdef
现在我想让Python pocketsphinx和pocketsphinx_continuous一样。
如何使Python pocketsphinx使用 CMN='current'
而不是 CMN='batch'
即如何使Python pocketsphinx显示在输出中?
INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='current', VARNORM='no', AGC='none'
INFO: cmn.c(143): mean[0]= 12.00, mean[1..12]= 0.0
INFO: acmod.c(154): Reading linear feature transformation from zero_ru.cd_cont_4000/feature_transform
INFO: mdef.c(518): Reading model definition: zero_ru.cd_cont_4000/mdef
而不是
INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='batch', VARNORM='no', AGC='none'
INFO: acmod.c(152): Reading linear feature transformation from c:/Projects/pocketsphinx-5prealpha-win32/pocketsphinx/bin/Release/x64/zero_ru.cd_cont_4000/feature_transform
INFO: mdef.c(518): Reading model definition: c:/Projects/pocketsphinx-5prealpha-win32/pocketsphinx/bin/Release/x64/zero_ru.cd_cont_4000/mdef
? :)
Batch和current是相同的模式。它只是在某个时间点上重命名了,它只是取决于版本。
幻影检测可能是由于你的jsgf中的词汇量非常小,而不是cmn。
Pocketsphinx现在还挺过时的软件,你最好用vosk代替。