2017-04-26 118 views
1

我正在使用pocketsphinx将音频转换为文本。它工作正常。现在我想要得到每个单词的时间戳。这是我的代码:pocketsphinx python给出错误的时间戳

import speech_recognition as sr 

r = sr.Recognizer() 
framerate = 100 
with sr.AudioFile("1.wav") as source: 

    audio = r.record(source) 

    decoder = r.recognize_sphinx(audio, show_all=False) 

    print ([(seg.word, seg.start_frame/framerate)for seg in decoder.seg()]) 

根据他们的文档,默认的帧率是100.我得到了每个单词的开始时间。但是,这是不正确的。差别是2秒,有时超过3秒。

这是已知的问题或我错过了什么?

回答

1

我读的地方,发生率为1/100所以,我的项目,我除以,事故的1/10代替1/100但结果是因为我在做什么实际的罚款。我建议除以0.10.01并查看提供给您的内容。

因此,对于你的代码只是尝试一下这些变量:

framerate = .1 

OR

framerate = .01