用于异步 Http 接口的 IBM Watson 语音转文本 API

IBM Watson Speech to Text API for Asynchronous Http Interface

我是 IBM Watson 的新手,但我需要通过异步调用使用 SpeechtoText 服务。我在他们的文档中找到了两种解决方案,但我不知道它们之间有什么区别,我应该使用哪一种。

第一个:

To call a method asynchronously, use the enqueue method of the ServiceCall interface to receive a callback when the response arrives. The ServiceCallback interface of the method's argument provides onResponse and onFailure methods that you override to handle the callback.

第二个:

The asynchronous HTTP interface of the Speech to Text service provides methods for transcribing audio via non-blocking calls to the service. The interface employs user-specified secret strings and digital signatures to provide a level of security for requests that are made over the HTTP protocol. To use the asynchronous interface, you can register a callback URL to be notified by the service of the job status and the results automatically. Poll the service to obtain the job status and the results manually.

第二种方法适用于任何编程语言。第一种仅适用于 Java,由 Watson Developer Cloud 的 JAVA SDK 实现,很可能使用第二种方法。

即。如果您使用第二种方法,您可能必须编写样板,使其看起来像入队版本。那么为什么不只使用第一种方法 - 即。排队。