簡體   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