繁体   English   中英

Watson IBM Speech to Text c# api

[英]Watson IBM Speech to Text c# api

我使用以下示例从音频https://gist.github.com/nfriedly/0240e862901474a9447a600e5795d500 中识别文本,但我还需要时间码,我在第 40 行添加了"timestamps" : true ,并根据需要删除了"interim_results": true只有最终结果。 但是它坏了,在{ "state": "listening" }消息之后,它需要一些时间并引发异常,例如"Text" received message is invalid after the call Websocket.Closeasync. Websockets.In cases closeasync, so you should only use those when you do not expect to receive other data from the remote endpoint. Use "Websockets.CloseOutputAsync" to preserve the possibility of obtaining additional data, but to close the outgoing channel. "Text" received message is invalid after the call Websocket.Closeasync. Websockets.In cases closeasync, so you should only use those when you do not expect to receive other data from the remote endpoint. Use "Websockets.CloseOutputAsync" to preserve the possibility of obtaining additional data, but to close the outgoing channel.

如果我设置"continuous" : false ,它只执行第一次语音迭代(停顿前的几个词),然后重复{"state": "listening" }并冻结。

你能帮我吗,如何更新那个例子来返回时间码?

continuous: false意味着“只转录到第一次暂停” - 所以它不是“冻结”,它只是在你告诉它时停止。

然后,服务发送最终结果,然后是第二个{"state": "listening"}消息,表明它已完成发送结果。 示例代码在此之后关闭连接,但听起来您在关闭连接后仍在尝试发送音频。

我不确定,但我认为timestampsinterim_results可能会按照你想要的方式工作,一旦你设置了continuous: false

虽然,如果您只需要最终结果,那么 HTTP 接口可能更有意义。 它比 WebSockets 简单得多。

最后,正如我在电子邮件中提到的,官方 IBM Watson .net SDK 现在在 开发分支中支持 Speech to Text,并且应该很快将其包含在一个版本中

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM