Add Speech Streaming usage documentation.#2483
Add Speech Streaming usage documentation.#2483daspecster wants to merge 2 commits intogoogleapis:masterfrom
Conversation
d301917 to
4456756
Compare
dhermes
left a comment
There was a problem hiding this comment.
My nits aren't really with these docs, they are with the implementation. WDYT?
docs/speech-usage.rst
Outdated
|
|
||
| >>> results = client.stream_recognize('hello.flac', 'FLAC', 44100, | ||
| ... interim_results=True) | ||
| >>> print results |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| 0.96976006031 | ||
|
|
||
| For continuous speech containing more than one word, the ``single_utterance`` | ||
| option should be disabled. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
docs/speech-usage.rst
Outdated
|
|
||
| >>> from google.cloud import speech | ||
| >>> client = speech.Client() | ||
| >>> results = client.stream_recognize('hello.flac', 'FLAC', 44100) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| >>> results[2].alternatives[0].transcript | ||
| hello | ||
| >>> results[2].alternatives[0].confidence | ||
| 0.96976006031 |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
docs/speech-usage.rst
Outdated
| } | ||
| is_final: true | ||
| } | ||
| ] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| transcript: Hello, this is one test | ||
| confidence: 0 | ||
|
|
||
|
|
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| >>> sample = client.sample(source_uri='gs://my-bucket/recording.flac', | ||
| ... encoding=Encoding.FLAC, | ||
| ... sample_rate=44100) | ||
| >>> results = client.stream_recognize(sample, single_utterance=False) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| ... encoding=Encoding.FLAC, | ||
| ... sample_rate=44100) | ||
| >>> results = client.stream_recognize(sample, interim_results=True) | ||
| >>> print results[0].alternatives.transcript |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
I'm going to close this and make a new PR with the whole shebang. |
Speech streaming has some implications to it that I think could be good to talk about.
interum_resultsisTrue, should weyieldthe results as we receive them?