Google 语音 API 现场识别

Google Speech API Live Recognition

我们正在开发 java 应用程序。我会使用 Google Cloud Speech 库,但我们的应用程序基于 osgi,所以我宁愿使用 Google Cloud Speech Rest API。我想知道是否可以用这个休息来做某种现场语音识别 api。我可以发出单个请求,但我想流式传输我的音频数据并随着时间的推移处理结果。

来自 Google 云演讲 API 文档:

Streaming speech recognition allows you to stream audio to Cloud Speech-to-Text and receive a stream speech recognition results in real time as the audio is processed. See also the audio limits for streaming speech recognition requests. Streaming speech recognition is available via gRPC only.

如果您想将此 API 与 OSGI 一起使用,您必须自己操作清单。你可能 运行 遇到一些问题,因为 grpc 指的是 SPI (ServiceLoader/Provider)。我建议您在使用此服务时遇到问题时使用 Apache Aries SPI Fly (http://aries.apache.org/modules/spi-fly.html),