我正在使用 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/