Speech recognition pocketsphinx:返回作为单一结果的长语句

Speech recognition pocketsphinx:返回作为单一结果的长语句,speech-recognition,speech-to-text,cmusphinx,pocketsphinx,Speech Recognition,Speech To Text,Cmusphinx,Pocketsphinx,在分析大约1分钟长的声音文件时,pocketsphinx会将该文件分解为多个结果。有没有办法更改代码以返回单个语句?我使用的代码基于连续测试.py #!/usr/bin/python from os import environ, path from pocketsphinx.pocketsphinx import * from sphinxbase.sphinxbase import * MODELDIR = "../../../model" DATADIR = "../../../te

在分析大约1分钟长的声音文件时,pocketsphinx会将该文件分解为多个结果。有没有办法更改代码以返回单个语句?我使用的代码基于
连续测试.py

#!/usr/bin/python

from os import environ, path

from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *

MODELDIR = "../../../model"
DATADIR = "../../../test/data"

config = Decoder.default_config()
config.set_string('-hmm', path.join(MODELDIR, 'en-us/en-us'))
config.set_string('-lm', path.join(MODELDIR, 'en-us/en-us.lm.bin'))
config.set_string('-dict', path.join(MODELDIR, 'en-us/cmudict-en-us.dict'))
config.set_string('-logfn', '/dev/null')
decoder = Decoder(config)

stream = open(path.join(DATADIR, 'goforward.raw'), 'rb')
#stream = open('10001-90210-01803.wav', 'rb')

in_speech_bf = False
decoder.start_utt()
while True:
    buf = stream.read(1024)
    if buf:
        decoder.process_raw(buf, False, False)
        if decoder.get_in_speech() != in_speech_bf:
            in_speech_bf = decoder.get_in_speech()
            if not in_speech_bf:
                decoder.end_utt()
                print 'Result:', decoder.hyp().hypstr
                decoder.start_utt()
    else:
        break
decoder.end_utt()

这只是连接每个结果。你仍然可以得到所有的标签,例如.result.replace(“”,“”),谢谢,但它仍然不能让我看到总体信心分数等。它为什么以及如何打断话语,而不是返回一个结果?你可以为
secondsofshealtetodect
result = "" 

in_speech_bf = False
decoder.start_utt()
while True:
    buf = stream.read(1024)
    if buf:
        decoder.process_raw(buf, False, False)
        if decoder.get_in_speech() != in_speech_bf:
            in_speech_bf = decoder.get_in_speech()
            if not in_speech_bf:
                decoder.end_utt()
                result = result + decoder.hyp().hypstr
                decoder.start_utt()
    else:
        break
decoder.end_utt()

return result