python - 如何获得对 Pocket Sphinx 转录的信心

标签 python speech-recognition pocketsphinx

我正在使用 sphinx 将音频转换为文本,但我找不到如何访问每个单词的置信度得分

我可以访问转录输出,但无法获得模型背后的估计概率。这感觉很基本,但我找不到合适的文档。我应该在下面添加什么?

test = sr.AudioFile(audio_file)
Recon = sr.Recognizer()

with test as source:
    test_audio = Recon.record(source)
text = Recon.recognize_sphinx(test_audio,language = 'en-US')```

最佳答案

当前版本的语音识别未返回置信度结果。如果您查看 implementation :

def recognize_sphinx(...):
   ...
   # return results
   hypothesis = decoder.hyp()
   if hypothesis is not None: return hypothesis.hypstr
   raise UnknownValueError()  # no transcriptions available

您会看到仅返回文本结果 (hypothesis.hypstr),而置信度在 hypothesis.prob 中。一个快速的解决方法是复制粘贴 entire method单独安装 pocketsphinx 后:

pip install pocketsphinx

关于python - 如何获得对 Pocket Sphinx 转录的信心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57350706/

相关文章:

python - PyQt:覆盖 QGraphicsView.drawItems

python - 如何获得一套字典?

ios - 使用 AudioKit 将音频文件作为麦克风输入播放 - 用于 iOS 模拟器听写测试

python - 安装pocketsphinx python模块: command 'swig.exe' failed

python - 实时语音识别

python - 如何使用递归判断字符串中是否包含字符?

python - Python egg 的源代码在哪里?

python - 如何修复 : MatplotlibDeprecationWarning: shading ='flat' when X and Y have the same dimensions as C is deprecated since 3. 3

speech-recognition - 如何在帧上分割语音数据并计算 MFCC

android - 从基于字符串的语法导入语法规则