我刚开始使用houndify,我一直在创建STT(语音到文本)过程,我有一个用python创建它的想法,我选择了houndify python2.7sdk,我已经获得了houndify service.So的客户机id和客户端密钥,我如何进行语音到文本conversion?.Please的逐步解决呢?
发布于 2017-02-23 20:55:01
Python包含两个示例脚本,说明如何向Houndify发送语音查询: sample_stdin.py和sample_wave.py。无论音频的来源如何,步骤如下:
houndify.StreamingHoundClient、clientKey和一些userID初始化clientKey对象(在开发过程中可以是"test_user“,但理想情况下应该与最终用户相对应)houndify.HoundListener类start()方法client.fill(samples)。client.finish()您可以在这里找到有关SDK的更多详细信息(包括设置请求信息字段的信息):https://docs.houndify.com/sdks/docs/python。
下面是一个简单的脚本,它从stdin读取音频,并只打印部分记录、最终响应或错误消息:
import sys
import houndify
class MyListener(houndify.HoundListener):
def onPartialTranscript(self, transcript):
print "Partial transcript: " + transcript
def onFinalResponse(self, response):
print "Final response: " + str(response)
def onError(self, err):
print "Error: " + str(err)
client = houndify.StreamingHoundClient(<CLIENT_ID>, <CLIENT_KEY>, "test_user", sampleRate = 8000)
BUFFER_SIZE = 512
client.start(MyListener())
while True:
samples = sys.stdin.read(BUFFER_SIZE)
if len(samples) == 0: break
finished = client.fill(samples)
if finished: break
client.finish()https://stackoverflow.com/questions/42392780
复制相似问题