-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add speech asynchronous recognize support. #2426
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
Conversation
| config['profanityFilter'] = profanity_filter | ||
| if speech_context is not None: | ||
| config['speechContext'] = {'phrases': speech_context} | ||
| def _build_request_data(content, source_uri, encoding, sample_rate, |
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.
dhermes
left a comment
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.
I'm not 100% but I think there is a utility in google.protobuf for parsing a JSON version of a protobuf message type (here it is Operation)
docs/speech-usage.rst
Outdated
| >>> operation.complete | ||
| True | ||
| >>> operation.results[0]['alternatives'][0]['transcript'] | ||
| "how old is the Brooklyn Bridge" |
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
| ... operation.poll() # API call | ||
| >>> operation.complete | ||
| True | ||
| >>> operation.results[0]['alternatives'][0]['transcript'] |
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.
| AMR_WB = 'AMR_WB' | ||
| """AMR_WB encoding type.""" | ||
| from google.cloud.speech.encoding import Encoding | ||
| from google.cloud.speech.operation import Operation |
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.
| config['profanityFilter'] = profanity_filter | ||
| if speech_context is not None: | ||
| config['speechContext'] = {'phrases': speech_context} | ||
| def _build_request_data(content, source_uri, encoding, sample_rate, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
google/cloud/speech/operation.py
Outdated
| from google.cloud._helpers import _rfc3339_to_datetime | ||
|
|
||
|
|
||
| class Operation(object): |
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.
unit_tests/speech/_fixtures.py
Outdated
| } | ||
| ] | ||
| } | ||
| ] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
unit_tests/speech/_fixtures.py
Outdated
| ] | ||
| } | ||
| ] | ||
| } |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
unit_tests/speech/_fixtures.py
Outdated
| 'startTime': '2016-09-22T17:52:25.536964Z', | ||
| 'lastUpdateTime': '2016-09-22T17:52:27.802902Z' | ||
| }, | ||
| 'done': False |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
unit_tests/speech/_fixtures.py
Outdated
| 'google.cloud.speech.v1beta1.AsyncRecognizeMetadata'), | ||
| 'progressPercent': 27, | ||
| 'startTime': '2016-09-22T17:52:25.536964Z', | ||
| 'lastUpdateTime': '2016-09-22T17:52:27.802902Z' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| """The version of the API, used in building the API call's URL.""" | ||
|
|
||
| API_URL_TEMPLATE = '{api_base_url}/{api_version}/speech:{path}' | ||
| API_URL_TEMPLATE = '{api_base_url}/{api_version}/{path}' |
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.
|
@dhermes was there supposed to be a link in here?
|
| encoding, | ||
| self.SAMPLE_RATE) | ||
| self.assertIsInstance(operation, Operation) | ||
| self.assertFalse(operation.complete) |
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
| ... operation.poll() # API call | ||
| >>> operation.complete | ||
| True | ||
| >>> operation.results[0]['alternatives'][0]['transcript'] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| """The version of the API, used in building the API call's URL.""" | ||
|
|
||
| API_URL_TEMPLATE = '{api_base_url}/{api_version}/speech:{path}' | ||
| API_URL_TEMPLATE = '{api_base_url}/{api_version}/{path}' |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
7942a39 to
92b2b89
Compare
|
@tseaver I think I got all the things you mentioned. LMKWYT |
unit_tests/speech/test_operation.py
Outdated
| self._requested = [] | ||
|
|
||
| def api_request(self, method, path): | ||
| self._requested.append({'method': method, 'path': path}) |
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.
|
@daspecster Should be OK to merge if you can tweak the assertions for the operations tests (see above). |
Add speech asynchronous recognize support.
Add speech asynchronous recognize support.
Add speech asynchronous recognize support.
Add support for Speech API long running operations.