-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Speech Streaming usage documentation. #2483
Conversation
d301917
to
4456756
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My nits aren't really with these docs, they are with the implementation. WDYT?
|
||
>>> 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.
|
||
>>> 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.
} | ||
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.
@@ -97,6 +97,7 @@ Great Britian. | |||
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_results
isTrue
, should weyield
the results as we receive them?