<p>不确定这个答案是否正是您想要的,但听起来像是参数<code>continuous</code>的问题。在</p>
<p>如您所见,lib <a href="https://github.com/watson-developer-cloud/python-sdk" rel="nofollow noreferrer">Python SDK</a>位于Watson开发人员云中。在</p>
<p>您可以使用安装:<code>pip install watson-developer-cloud</code></p>
<pre><code>import json
from os.path import join, dirname
from watson_developer_cloud import SpeechToTextV1
speech_to_text = SpeechToTextV1(
username='YOUR SERVICE USERNAME',
password='YOUR SERVICE PASSWORD',
x_watson_learning_opt_out=False
)
print(json.dumps(speech_to_text.models(), indent=2))
print(json.dumps(speech_to_text.get_model('en-US_BroadbandModel'), indent=2))
with open(join(dirname(__file__), '../resources/speech.wav'),
'rb') as audio_file:
data = json.dumps(speech_to_text.recognize(audio_file, content_type='audio/wav', timestamps=False, word_confidence=False, continuous=True), indent=2)
print(data)
</code></pre>
<p><strong>Obs.:</strong>服务返回<code>array</code>个结果,每个语句一个。在</p>
<p>在<a href="https://github.com/watson-developer-cloud/python-sdk/blob/master/watson_developer_cloud/speech_to_text_v1.py#L44" rel="nofollow noreferrer">#L44</a>行中,有您可以使用的<code>params</code>,因此,对于连续转录,您需要使用参数<code>continuous</code>,并像上面的例子一样设置为<code>true</code>。在</p>
<ul>
<li>请参阅<a href="https://console.bluemix.net/docs/services/speech-to-text/websockets.html#WSkeep" rel="nofollow noreferrer">Official Documentation</a>讨论Websockets以保持连接的有效性。(也许这就是你需要的)。在</li>
</ul>