diff --git a/packages/google-cloud-python-speech/.coveragerc b/packages/google-cloud-python-speech/.coveragerc index b178b094aa1d..dd39c8546c41 100644 --- a/packages/google-cloud-python-speech/.coveragerc +++ b/packages/google-cloud-python-speech/.coveragerc @@ -1,3 +1,19 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Generated by synthtool. DO NOT EDIT! [run] branch = True diff --git a/packages/google-cloud-python-speech/.flake8 b/packages/google-cloud-python-speech/.flake8 index 0268ecc9c55c..ed9316381c9c 100644 --- a/packages/google-cloud-python-speech/.flake8 +++ b/packages/google-cloud-python-speech/.flake8 @@ -1,3 +1,19 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Generated by synthtool. DO NOT EDIT! [flake8] ignore = E203, E266, E501, W503 @@ -5,6 +21,8 @@ exclude = # Exclude generated code. **/proto/** **/gapic/** + **/services/** + **/types/** *_pb2.py # Standard linting exemptions. diff --git a/packages/google-cloud-python-speech/.github/ISSUE_TEMPLATE/bug_report.md b/packages/google-cloud-python-speech/.github/ISSUE_TEMPLATE/bug_report.md index 2924b3fbc717..464ed925eccb 100644 --- a/packages/google-cloud-python-speech/.github/ISSUE_TEMPLATE/bug_report.md +++ b/packages/google-cloud-python-speech/.github/ISSUE_TEMPLATE/bug_report.md @@ -11,8 +11,7 @@ Thanks for stopping by to let us know something could be better! Please run down the following list and make sure you've tried the usual "quick fixes": - Search the issues already opened: https://github.com/googleapis/python-speech/issues - - Search the issues on our "catch-all" repository: https://github.com/googleapis/google-cloud-python - - Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+python + - Search StackOverflow: https://stackoverflow.com/questions/tagged/google-cloud-platform+python If you are still having issues, please be sure to include as much information as possible: diff --git a/packages/google-cloud-python-speech/.gitignore b/packages/google-cloud-python-speech/.gitignore index 3fb06e09ce74..b87e1ed580d9 100644 --- a/packages/google-cloud-python-speech/.gitignore +++ b/packages/google-cloud-python-speech/.gitignore @@ -10,6 +10,7 @@ dist build eggs +.eggs parts bin var @@ -49,6 +50,7 @@ bigquery/docs/generated # Virtual environment env/ coverage.xml +sponge_log.xml # System test environment variables. system_tests/local_test_setup diff --git a/packages/google-cloud-python-speech/.kokoro/publish-docs.sh b/packages/google-cloud-python-speech/.kokoro/publish-docs.sh index 53c8bb08daab..ac4902c587ff 100755 --- a/packages/google-cloud-python-speech/.kokoro/publish-docs.sh +++ b/packages/google-cloud-python-speech/.kokoro/publish-docs.sh @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/bin/bash - set -eo pipefail # Disable buffering, so that the logs stream through. diff --git a/packages/google-cloud-python-speech/.kokoro/release.sh b/packages/google-cloud-python-speech/.kokoro/release.sh index 357a9b997d2e..5c660c553697 100755 --- a/packages/google-cloud-python-speech/.kokoro/release.sh +++ b/packages/google-cloud-python-speech/.kokoro/release.sh @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!/bin/bash - set -eo pipefail # Start the releasetool reporter diff --git a/packages/google-cloud-python-speech/.kokoro/samples/lint/common.cfg b/packages/google-cloud-python-speech/.kokoro/samples/lint/common.cfg new file mode 100644 index 000000000000..ba51d2d647bc --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/samples/lint/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Specify which tests to run +env_vars: { + key: "RUN_TESTS_SESSION" + value: "lint" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-speech/.kokoro/test-samples.sh" +} + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" +} + +# Download secrets for samples +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "python-speech/.kokoro/trampoline.sh" \ No newline at end of file diff --git a/packages/google-cloud-python-speech/.kokoro/samples/lint/continuous.cfg b/packages/google-cloud-python-speech/.kokoro/samples/lint/continuous.cfg new file mode 100644 index 000000000000..a1c8d9759c88 --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/samples/lint/continuous.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/packages/google-cloud-python-speech/.kokoro/samples/lint/periodic.cfg b/packages/google-cloud-python-speech/.kokoro/samples/lint/periodic.cfg new file mode 100644 index 000000000000..50fec9649732 --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/samples/lint/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} \ No newline at end of file diff --git a/packages/google-cloud-python-speech/.kokoro/samples/lint/presubmit.cfg b/packages/google-cloud-python-speech/.kokoro/samples/lint/presubmit.cfg new file mode 100644 index 000000000000..a1c8d9759c88 --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/samples/lint/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/packages/google-cloud-python-speech/.kokoro/samples/python3.6/common.cfg b/packages/google-cloud-python-speech/.kokoro/samples/python3.6/common.cfg new file mode 100644 index 000000000000..722c18ad1fe4 --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/samples/python3.6/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Specify which tests to run +env_vars: { + key: "RUN_TESTS_SESSION" + value: "py-3.6" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-speech/.kokoro/test-samples.sh" +} + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" +} + +# Download secrets for samples +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "python-speech/.kokoro/trampoline.sh" \ No newline at end of file diff --git a/packages/google-cloud-python-speech/.kokoro/samples/python3.6/continuous.cfg b/packages/google-cloud-python-speech/.kokoro/samples/python3.6/continuous.cfg new file mode 100644 index 000000000000..7218af1499e5 --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/samples/python3.6/continuous.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} + diff --git a/packages/google-cloud-python-speech/.kokoro/samples/python3.6/periodic.cfg b/packages/google-cloud-python-speech/.kokoro/samples/python3.6/periodic.cfg new file mode 100644 index 000000000000..50fec9649732 --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/samples/python3.6/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} \ No newline at end of file diff --git a/packages/google-cloud-python-speech/.kokoro/samples/python3.6/presubmit.cfg b/packages/google-cloud-python-speech/.kokoro/samples/python3.6/presubmit.cfg new file mode 100644 index 000000000000..a1c8d9759c88 --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/samples/python3.6/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/packages/google-cloud-python-speech/.kokoro/samples/python3.7/common.cfg b/packages/google-cloud-python-speech/.kokoro/samples/python3.7/common.cfg new file mode 100644 index 000000000000..80312b4765df --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/samples/python3.7/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Specify which tests to run +env_vars: { + key: "RUN_TESTS_SESSION" + value: "py-3.7" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-speech/.kokoro/test-samples.sh" +} + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" +} + +# Download secrets for samples +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "python-speech/.kokoro/trampoline.sh" \ No newline at end of file diff --git a/packages/google-cloud-python-speech/.kokoro/samples/python3.7/continuous.cfg b/packages/google-cloud-python-speech/.kokoro/samples/python3.7/continuous.cfg new file mode 100644 index 000000000000..a1c8d9759c88 --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/samples/python3.7/continuous.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/packages/google-cloud-python-speech/.kokoro/samples/python3.7/periodic.cfg b/packages/google-cloud-python-speech/.kokoro/samples/python3.7/periodic.cfg new file mode 100644 index 000000000000..50fec9649732 --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/samples/python3.7/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} \ No newline at end of file diff --git a/packages/google-cloud-python-speech/.kokoro/samples/python3.7/presubmit.cfg b/packages/google-cloud-python-speech/.kokoro/samples/python3.7/presubmit.cfg new file mode 100644 index 000000000000..a1c8d9759c88 --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/samples/python3.7/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/packages/google-cloud-python-speech/.kokoro/samples/python3.8/common.cfg b/packages/google-cloud-python-speech/.kokoro/samples/python3.8/common.cfg new file mode 100644 index 000000000000..0b1b35c3d01f --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/samples/python3.8/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Specify which tests to run +env_vars: { + key: "RUN_TESTS_SESSION" + value: "py-3.8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-speech/.kokoro/test-samples.sh" +} + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker" +} + +# Download secrets for samples +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "python-speech/.kokoro/trampoline.sh" \ No newline at end of file diff --git a/packages/google-cloud-python-speech/.kokoro/samples/python3.8/continuous.cfg b/packages/google-cloud-python-speech/.kokoro/samples/python3.8/continuous.cfg new file mode 100644 index 000000000000..a1c8d9759c88 --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/samples/python3.8/continuous.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/packages/google-cloud-python-speech/.kokoro/samples/python3.8/periodic.cfg b/packages/google-cloud-python-speech/.kokoro/samples/python3.8/periodic.cfg new file mode 100644 index 000000000000..50fec9649732 --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/samples/python3.8/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} \ No newline at end of file diff --git a/packages/google-cloud-python-speech/.kokoro/samples/python3.8/presubmit.cfg b/packages/google-cloud-python-speech/.kokoro/samples/python3.8/presubmit.cfg new file mode 100644 index 000000000000..a1c8d9759c88 --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/samples/python3.8/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/packages/google-cloud-python-speech/.kokoro/test-samples.sh b/packages/google-cloud-python-speech/.kokoro/test-samples.sh new file mode 100755 index 000000000000..71d18fb0b5a1 --- /dev/null +++ b/packages/google-cloud-python-speech/.kokoro/test-samples.sh @@ -0,0 +1,104 @@ +#!/bin/bash +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# `-e` enables the script to automatically fail when a command fails +# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero +set -eo pipefail +# Enables `**` to include files nested inside sub-folders +shopt -s globstar + +cd github/python-speech + +# Run periodic samples tests at latest release +if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then + LATEST_RELEASE=$(git describe --abbrev=0 --tags) + git checkout $LATEST_RELEASE +fi + +# Disable buffering, so that the logs stream through. +export PYTHONUNBUFFERED=1 + +# Debug: show build environment +env | grep KOKORO + +# Install nox +python3.6 -m pip install --upgrade --quiet nox + +# Use secrets acessor service account to get secrets +if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then + gcloud auth activate-service-account \ + --key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \ + --project="cloud-devrel-kokoro-resources" +fi + +# This script will create 3 files: +# - testing/test-env.sh +# - testing/service-account.json +# - testing/client-secrets.json +./scripts/decrypt-secrets.sh + +source ./testing/test-env.sh +export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json + +# For cloud-run session, we activate the service account for gcloud sdk. +gcloud auth activate-service-account \ + --key-file "${GOOGLE_APPLICATION_CREDENTIALS}" + +export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json + +echo -e "\n******************** TESTING PROJECTS ********************" + +# Switch to 'fail at end' to allow all tests to complete before exiting. +set +e +# Use RTN to return a non-zero value if the test fails. +RTN=0 +ROOT=$(pwd) +# Find all requirements.txt in the samples directory (may break on whitespace). +for file in samples/**/requirements.txt; do + cd "$ROOT" + # Navigate to the project folder. + file=$(dirname "$file") + cd "$file" + + echo "------------------------------------------------------------" + echo "- testing $file" + echo "------------------------------------------------------------" + + # Use nox to execute the tests for the project. + python3.6 -m nox -s "$RUN_TESTS_SESSION" + EXIT=$? + + # If this is a periodic build, send the test log to the Build Cop Bot. + # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop. + if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then + chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop + $KOKORO_GFILE_DIR/linux_amd64/buildcop + fi + + if [[ $EXIT -ne 0 ]]; then + RTN=1 + echo -e "\n Testing failed: Nox returned a non-zero exit code. \n" + else + echo -e "\n Testing completed.\n" + fi + +done +cd "$ROOT" + +# Workaround for Kokoro permissions issue: delete secrets +rm testing/{test-env.sh,client-secrets.json,service-account.json} + +exit "$RTN" \ No newline at end of file diff --git a/packages/google-cloud-python-speech/CONTRIBUTING.rst b/packages/google-cloud-python-speech/CONTRIBUTING.rst index c37e4a6cc7d1..db90cf3cc2d9 100644 --- a/packages/google-cloud-python-speech/CONTRIBUTING.rst +++ b/packages/google-cloud-python-speech/CONTRIBUTING.rst @@ -22,7 +22,7 @@ In order to add a feature: documentation. - The feature must work fully on the following CPython versions: 2.7, - 3.5, 3.6, and 3.7 on both UNIX and Windows. + 3.5, 3.6, 3.7 and 3.8 on both UNIX and Windows. - The feature must not add unnecessary dependencies (where "unnecessary" is of course subjective, but new dependencies should @@ -214,26 +214,18 @@ We support: - `Python 3.5`_ - `Python 3.6`_ - `Python 3.7`_ +- `Python 3.8`_ .. _Python 3.5: https://docs.python.org/3.5/ .. _Python 3.6: https://docs.python.org/3.6/ .. _Python 3.7: https://docs.python.org/3.7/ +.. _Python 3.8: https://docs.python.org/3.8/ Supported versions can be found in our ``noxfile.py`` `config`_. .. _config: https://github.com/googleapis/python-speech/blob/master/noxfile.py -We explicitly decided not to support `Python 2.5`_ due to `decreased usage`_ -and lack of continuous integration `support`_. - -.. _Python 2.5: https://docs.python.org/2.5/ -.. _decreased usage: https://caremad.io/2013/10/a-look-at-pypi-downloads/ -.. _support: https://blog.travis-ci.com/2013-11-18-upcoming-build-environment-updates/ - -We have `dropped 2.6`_ as a supported version as well since Python 2.6 is no -longer supported by the core development team. - Python 2.7 support is deprecated. All code changes should maintain Python 2.7 compatibility until January 1, 2020. We also explicitly decided to support Python 3 beginning with version @@ -247,7 +239,6 @@ We also explicitly decided to support Python 3 beginning with version .. _prominent: https://docs.djangoproject.com/en/1.9/faq/install/#what-python-version-can-i-use-with-django .. _projects: http://flask.pocoo.org/docs/0.10/python3/ .. _Unicode literal support: https://www.python.org/dev/peps/pep-0414/ -.. _dropped 2.6: https://github.com/googleapis/google-cloud-python/issues/995 ********** Versioning diff --git a/packages/google-cloud-python-speech/MANIFEST.in b/packages/google-cloud-python-speech/MANIFEST.in index cd011be27a0e..e9e29d12033d 100644 --- a/packages/google-cloud-python-speech/MANIFEST.in +++ b/packages/google-cloud-python-speech/MANIFEST.in @@ -1,6 +1,25 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Generated by synthtool. DO NOT EDIT! include README.rst LICENSE recursive-include google *.json *.proto recursive-include tests * global-exclude *.py[co] global-exclude __pycache__ + +# Exclude scripts for samples readmegen +prune scripts/readme-gen \ No newline at end of file diff --git a/packages/google-cloud-python-speech/docs/conf.py b/packages/google-cloud-python-speech/docs/conf.py index be3e6aa62a9e..5867eb96952b 100644 --- a/packages/google-cloud-python-speech/docs/conf.py +++ b/packages/google-cloud-python-speech/docs/conf.py @@ -38,21 +38,18 @@ "sphinx.ext.napoleon", "sphinx.ext.todo", "sphinx.ext.viewcode", + "recommonmark", ] # autodoc/autosummary flags autoclass_content = "both" -autodoc_default_flags = ["members"] +autodoc_default_options = {"members": True} autosummary_generate = True # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] -# Allow markdown includes (so releases.md can include CHANGLEOG.md) -# http://www.sphinx-doc.org/en/master/markdown.html -source_parsers = {".md": "recommonmark.parser.CommonMarkParser"} - # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # source_suffix = ['.rst', '.md'] @@ -340,7 +337,7 @@ intersphinx_mapping = { "python": ("http://python.readthedocs.org/en/latest/", None), "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None), + "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), "grpc": ("https://grpc.io/grpc/python/", None), } diff --git a/packages/google-cloud-python-speech/docs/index.rst b/packages/google-cloud-python-speech/docs/index.rst index 02f947a7e224..a9aabc984d0a 100644 --- a/packages/google-cloud-python-speech/docs/index.rst +++ b/packages/google-cloud-python-speech/docs/index.rst @@ -1,5 +1,7 @@ .. include:: README.rst +.. include:: multiprocessing.rst + Using the Library ----------------- diff --git a/packages/google-cloud-python-speech/docs/multiprocessing.rst b/packages/google-cloud-python-speech/docs/multiprocessing.rst new file mode 100644 index 000000000000..1cb29d4ca967 --- /dev/null +++ b/packages/google-cloud-python-speech/docs/multiprocessing.rst @@ -0,0 +1,7 @@ +.. note:: + + Because this client uses :mod:`grpcio` library, it is safe to + share instances across threads. In multiprocessing scenarios, the best + practice is to create client instances *after* the invocation of + :func:`os.fork` by :class:`multiprocessing.Pool` or + :class:`multiprocessing.Process`. diff --git a/packages/google-cloud-python-speech/google/cloud/speech.py b/packages/google-cloud-python-speech/google/cloud/speech.py index 792e3f6719de..244d2cd79f71 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech.py +++ b/packages/google-cloud-python-speech/google/cloud/speech.py @@ -22,4 +22,8 @@ from google.cloud.speech_v1 import types -__all__ = ("enums", "types", "SpeechClient") +__all__ = ( + "enums", + "types", + "SpeechClient", +) diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1/gapic/enums.py b/packages/google-cloud-python-speech/google/cloud/speech_v1/gapic/enums.py index fa6218ab83bd..e880d4349c54 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1/gapic/enums.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1/gapic/enums.py @@ -49,20 +49,21 @@ class AudioEncoding(enum.IntEnum): Attributes: ENCODING_UNSPECIFIED (int): Not specified. LINEAR16 (int): Uncompressed 16-bit signed little-endian samples (Linear PCM). - FLAC (int): ``FLAC`` (Free Lossless Audio Codec) is the recommended encoding because - it is lossless--therefore recognition is not compromised--and requires - only about half the bandwidth of ``LINEAR16``. ``FLAC`` stream encoding - supports 16-bit and 24-bit samples, however, not all fields in + FLAC (int): ``FLAC`` (Free Lossless Audio Codec) is the recommended encoding + because it is lossless--therefore recognition is not compromised--and + requires only about half the bandwidth of ``LINEAR16``. ``FLAC`` stream + encoding supports 16-bit and 24-bit samples, however, not all fields in ``STREAMINFO`` are supported. MULAW (int): 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. AMR (int): Adaptive Multi-Rate Narrowband codec. ``sample_rate_hertz`` must be 8000. - AMR_WB (int): Adaptive Multi-Rate Wideband codec. ``sample_rate_hertz`` must be 16000. + AMR_WB (int): Adaptive Multi-Rate Wideband codec. ``sample_rate_hertz`` must be + 16000. OGG_OPUS (int): Opus encoded audio frames in Ogg container (`OggOpus `__). ``sample_rate_hertz`` must be one of 8000, 12000, 16000, 24000, or 48000. - SPEEX_WITH_HEADER_BYTE (int): Although the use of lossy encodings is not recommended, if a very low - bitrate encoding is required, ``OGG_OPUS`` is highly preferred over + SPEEX_WITH_HEADER_BYTE (int): Although the use of lossy encodings is not recommended, if a very + low bitrate encoding is required, ``OGG_OPUS`` is highly preferred over Speex encoding. The `Speex `__ encoding supported by Cloud Speech API has a header byte in each block, as in MIME type ``audio/x-speex-with-header-byte``. It is a variant of the RTP Speex @@ -97,7 +98,7 @@ class InteractionType(enum.IntEnum): DISCUSSION (int): Multiple people in a conversation or discussion. For example in a meeting with two or more people actively participating. Typically all the primary people speaking would be in the same room (if not, see - PHONE\_CALL) + PHONE_CALL) PRESENTATION (int): One or more persons lecturing or presenting to others, mostly uninterrupted. PHONE_CALL (int): A phone-call or video-conference in which two or more people, who are @@ -182,11 +183,11 @@ class SpeechEventType(enum.IntEnum): Attributes: SPEECH_EVENT_UNSPECIFIED (int): No speech event specified. - END_OF_SINGLE_UTTERANCE (int): This event indicates that the server has detected the end of the user's - speech utterance and expects no additional speech. Therefore, the server - will not process additional audio (although it may subsequently return - additional results). The client should stop sending additional audio - data, half-close the gRPC connection, and wait for any additional + END_OF_SINGLE_UTTERANCE (int): This event indicates that the server has detected the end of the + user's speech utterance and expects no additional speech. Therefore, the + server will not process additional audio (although it may subsequently + return additional results). The client should stop sending additional + audio data, half-close the gRPC connection, and wait for any additional results until the server closes the gRPC connection. This event is only sent if ``single_utterance`` was set to ``true``, and is not used otherwise. diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1/gapic/speech_client.py b/packages/google-cloud-python-speech/google/cloud/speech_v1/gapic/speech_client.py index 83cb7f4452ce..ab4b2145488c 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1/gapic/speech_client.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1/gapic/speech_client.py @@ -38,7 +38,7 @@ from google.longrunning import operations_pb2 -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-speech").version +_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-speech",).version class SpeechClient(object): @@ -158,12 +158,12 @@ def __init__( self.transport = transport else: self.transport = speech_grpc_transport.SpeechGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials + address=api_endpoint, channel=channel, credentials=credentials, ) if client_info is None: client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION + gapic_version=_GAPIC_LIBRARY_VERSION, ) else: client_info.gapic_version = _GAPIC_LIBRARY_VERSION @@ -174,7 +174,7 @@ def __init__( # (Ordinarily, these are the defaults specified in the `*_config.py` # file next to this one.) self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] + client_config["interfaces"][self._INTERFACE_NAME], ) # Save a dictionary of cached API call functions. @@ -251,7 +251,7 @@ def recognize( client_info=self._client_info, ) - request = cloud_speech_pb2.RecognizeRequest(config=config, audio=audio) + request = cloud_speech_pb2.RecognizeRequest(config=config, audio=audio,) return self._inner_api_calls["recognize"]( request, retry=retry, timeout=timeout, metadata=metadata ) @@ -337,7 +337,7 @@ def long_running_recognize( ) request = cloud_speech_pb2.LongRunningRecognizeRequest( - config=config, audio=audio + config=config, audio=audio, ) operation = self._inner_api_calls["long_running_recognize"]( request, retry=retry, timeout=timeout, metadata=metadata @@ -360,8 +360,6 @@ def streaming_recognize( Performs bidirectional streaming speech recognition: receive results while sending audio. This method is only available via the gRPC API (not REST). - EXPERIMENTAL: This method interface might change in the future. - Example: >>> from google.cloud import speech_v1 >>> diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1/gapic/speech_client_config.py b/packages/google-cloud-python-speech/google/cloud/speech_v1/gapic/speech_client_config.py index 555d3f2a7005..fc9080f4770e 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1/gapic/speech_client_config.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1/gapic/speech_client_config.py @@ -2,35 +2,54 @@ "interfaces": { "google.cloud.speech.v1.Speech": { "retry_codes": { - "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "non_idempotent": [], + "retry_policy_1_codes": ["UNAVAILABLE", "DEADLINE_EXCEEDED"], + "no_retry_codes": [], + "no_retry_1_codes": [], }, "retry_params": { - "default": { + "retry_policy_1_params": { "initial_retry_delay_millis": 100, "retry_delay_multiplier": 1.3, "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 1000000, + "initial_rpc_timeout_millis": 5000000, "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 1000000, + "max_rpc_timeout_millis": 5000000, "total_timeout_millis": 5000000, - } + }, + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0, + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 5000000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 5000000, + "total_timeout_millis": 5000000, + }, }, "methods": { "Recognize": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default", + "timeout_millis": 5000000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params", }, "LongRunningRecognize": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", + "timeout_millis": 5000000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params", }, "StreamingRecognize": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", + "timeout_millis": 5000000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params", }, }, } diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1/gapic/transports/speech_grpc_transport.py b/packages/google-cloud-python-speech/google/cloud/speech_v1/gapic/transports/speech_grpc_transport.py index c0d9c39d2d0c..6ae4fafdc073 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1/gapic/transports/speech_grpc_transport.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1/gapic/transports/speech_grpc_transport.py @@ -54,7 +54,7 @@ def __init__( # exception (channels come with credentials baked in already). if channel is not None and credentials is not None: raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." + "The `channel` and `credentials` arguments are mutually " "exclusive.", ) # Create the channel. @@ -72,7 +72,9 @@ def __init__( # gRPC uses objects called "stubs" that are bound to the # channel and provide a basic method for each RPC. - self._stubs = {"speech_stub": cloud_speech_pb2_grpc.SpeechStub(channel)} + self._stubs = { + "speech_stub": cloud_speech_pb2_grpc.SpeechStub(channel), + } # Because this API includes a method that returns a # long-running operation (proto: google.longrunning.Operation), diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1/proto/cloud_speech_pb2.py b/packages/google-cloud-python-speech/google/cloud/speech_v1/proto/cloud_speech_pb2.py index d73b7c0ed160..56808d60dddd 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1/proto/cloud_speech_pb2.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1/proto/cloud_speech_pb2.py @@ -1,10 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/speech_v1/proto/cloud_speech.proto - -import sys - -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection @@ -31,12 +28,9 @@ name="google/cloud/speech_v1/proto/cloud_speech.proto", package="google.cloud.speech.v1", syntax="proto3", - serialized_options=_b( - "\n\032com.google.cloud.speech.v1B\013SpeechProtoP\001Z\n\x06\x63onfig\x18\x01 \x01(\x0b\x32).google.cloud.speech.v1.RecognitionConfigB\x03\xe0\x41\x02\x12<\n\x05\x61udio\x18\x02 \x01(\x0b\x32(.google.cloud.speech.v1.RecognitionAudioB\x03\xe0\x41\x02"\x9b\x01\n\x1bLongRunningRecognizeRequest\x12>\n\x06\x63onfig\x18\x01 \x01(\x0b\x32).google.cloud.speech.v1.RecognitionConfigB\x03\xe0\x41\x02\x12<\n\x05\x61udio\x18\x02 \x01(\x0b\x32(.google.cloud.speech.v1.RecognitionAudioB\x03\xe0\x41\x02"\x99\x01\n\x19StreamingRecognizeRequest\x12N\n\x10streaming_config\x18\x01 \x01(\x0b\x32\x32.google.cloud.speech.v1.StreamingRecognitionConfigH\x00\x12\x17\n\raudio_content\x18\x02 \x01(\x0cH\x00\x42\x13\n\x11streaming_request"\x8f\x01\n\x1aStreamingRecognitionConfig\x12>\n\x06\x63onfig\x18\x01 \x01(\x0b\x32).google.cloud.speech.v1.RecognitionConfigB\x03\xe0\x41\x02\x12\x18\n\x10single_utterance\x18\x02 \x01(\x08\x12\x17\n\x0finterim_results\x18\x03 \x01(\x08"\xdf\x05\n\x11RecognitionConfig\x12I\n\x08\x65ncoding\x18\x01 \x01(\x0e\x32\x37.google.cloud.speech.v1.RecognitionConfig.AudioEncoding\x12\x19\n\x11sample_rate_hertz\x18\x02 \x01(\x05\x12\x1b\n\x13\x61udio_channel_count\x18\x07 \x01(\x05\x12/\n\'enable_separate_recognition_per_channel\x18\x0c \x01(\x08\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x18\n\x10max_alternatives\x18\x04 \x01(\x05\x12\x18\n\x10profanity_filter\x18\x05 \x01(\x08\x12>\n\x0fspeech_contexts\x18\x06 \x03(\x0b\x32%.google.cloud.speech.v1.SpeechContext\x12 \n\x18\x65nable_word_time_offsets\x18\x08 \x01(\x08\x12$\n\x1c\x65nable_automatic_punctuation\x18\x0b \x01(\x08\x12L\n\x12\x64iarization_config\x18\x13 \x01(\x0b\x32\x30.google.cloud.speech.v1.SpeakerDiarizationConfig\x12=\n\x08metadata\x18\t \x01(\x0b\x32+.google.cloud.speech.v1.RecognitionMetadata\x12\r\n\x05model\x18\r \x01(\t\x12\x14\n\x0cuse_enhanced\x18\x0e \x01(\x08"\x8b\x01\n\rAudioEncoding\x12\x18\n\x14\x45NCODING_UNSPECIFIED\x10\x00\x12\x0c\n\x08LINEAR16\x10\x01\x12\x08\n\x04\x46LAC\x10\x02\x12\t\n\x05MULAW\x10\x03\x12\x07\n\x03\x41MR\x10\x04\x12\n\n\x06\x41MR_WB\x10\x05\x12\x0c\n\x08OGG_OPUS\x10\x06\x12\x1a\n\x16SPEEX_WITH_HEADER_BYTE\x10\x07"\x90\x01\n\x18SpeakerDiarizationConfig\x12"\n\x1a\x65nable_speaker_diarization\x18\x01 \x01(\x08\x12\x19\n\x11min_speaker_count\x18\x02 \x01(\x05\x12\x19\n\x11max_speaker_count\x18\x03 \x01(\x05\x12\x1a\n\x0bspeaker_tag\x18\x05 \x01(\x05\x42\x05\x18\x01\xe0\x41\x03"\xa0\x08\n\x13RecognitionMetadata\x12U\n\x10interaction_type\x18\x01 \x01(\x0e\x32;.google.cloud.speech.v1.RecognitionMetadata.InteractionType\x12$\n\x1cindustry_naics_code_of_audio\x18\x03 \x01(\r\x12[\n\x13microphone_distance\x18\x04 \x01(\x0e\x32>.google.cloud.speech.v1.RecognitionMetadata.MicrophoneDistance\x12Z\n\x13original_media_type\x18\x05 \x01(\x0e\x32=.google.cloud.speech.v1.RecognitionMetadata.OriginalMediaType\x12^\n\x15recording_device_type\x18\x06 \x01(\x0e\x32?.google.cloud.speech.v1.RecognitionMetadata.RecordingDeviceType\x12\x1d\n\x15recording_device_name\x18\x07 \x01(\t\x12\x1a\n\x12original_mime_type\x18\x08 \x01(\t\x12\x13\n\x0b\x61udio_topic\x18\n \x01(\t"\xc5\x01\n\x0fInteractionType\x12 \n\x1cINTERACTION_TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nDISCUSSION\x10\x01\x12\x10\n\x0cPRESENTATION\x10\x02\x12\x0e\n\nPHONE_CALL\x10\x03\x12\r\n\tVOICEMAIL\x10\x04\x12\x1b\n\x17PROFESSIONALLY_PRODUCED\x10\x05\x12\x10\n\x0cVOICE_SEARCH\x10\x06\x12\x11\n\rVOICE_COMMAND\x10\x07\x12\r\n\tDICTATION\x10\x08"d\n\x12MicrophoneDistance\x12#\n\x1fMICROPHONE_DISTANCE_UNSPECIFIED\x10\x00\x12\r\n\tNEARFIELD\x10\x01\x12\x0c\n\x08MIDFIELD\x10\x02\x12\x0c\n\x08\x46\x41RFIELD\x10\x03"N\n\x11OriginalMediaType\x12#\n\x1fORIGINAL_MEDIA_TYPE_UNSPECIFIED\x10\x00\x12\t\n\x05\x41UDIO\x10\x01\x12\t\n\x05VIDEO\x10\x02"\xa4\x01\n\x13RecordingDeviceType\x12%\n!RECORDING_DEVICE_TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nSMARTPHONE\x10\x01\x12\x06\n\x02PC\x10\x02\x12\x0e\n\nPHONE_LINE\x10\x03\x12\x0b\n\x07VEHICLE\x10\x04\x12\x18\n\x14OTHER_OUTDOOR_DEVICE\x10\x05\x12\x17\n\x13OTHER_INDOOR_DEVICE\x10\x06" \n\rSpeechContext\x12\x0f\n\x07phrases\x18\x01 \x03(\t"D\n\x10RecognitionAudio\x12\x11\n\x07\x63ontent\x18\x01 \x01(\x0cH\x00\x12\r\n\x03uri\x18\x02 \x01(\tH\x00\x42\x0e\n\x0c\x61udio_source"U\n\x11RecognizeResponse\x12@\n\x07results\x18\x02 \x03(\x0b\x32/.google.cloud.speech.v1.SpeechRecognitionResult"`\n\x1cLongRunningRecognizeResponse\x12@\n\x07results\x18\x02 \x03(\x0b\x32/.google.cloud.speech.v1.SpeechRecognitionResult"\x9e\x01\n\x1cLongRunningRecognizeMetadata\x12\x18\n\x10progress_percent\x18\x01 \x01(\x05\x12.\n\nstart_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x34\n\x10last_update_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\xb1\x02\n\x1aStreamingRecognizeResponse\x12!\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x12.google.rpc.Status\x12\x43\n\x07results\x18\x02 \x03(\x0b\x32\x32.google.cloud.speech.v1.StreamingRecognitionResult\x12]\n\x11speech_event_type\x18\x04 \x01(\x0e\x32\x42.google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType"L\n\x0fSpeechEventType\x12\x1c\n\x18SPEECH_EVENT_UNSPECIFIED\x10\x00\x12\x1b\n\x17\x45ND_OF_SINGLE_UTTERANCE\x10\x01"\xf2\x01\n\x1aStreamingRecognitionResult\x12J\n\x0c\x61lternatives\x18\x01 \x03(\x0b\x32\x34.google.cloud.speech.v1.SpeechRecognitionAlternative\x12\x10\n\x08is_final\x18\x02 \x01(\x08\x12\x11\n\tstability\x18\x03 \x01(\x02\x12\x32\n\x0fresult_end_time\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x13\n\x0b\x63hannel_tag\x18\x05 \x01(\x05\x12\x1a\n\rlanguage_code\x18\x06 \x01(\tB\x03\xe0\x41\x03"z\n\x17SpeechRecognitionResult\x12J\n\x0c\x61lternatives\x18\x01 \x03(\x0b\x32\x34.google.cloud.speech.v1.SpeechRecognitionAlternative\x12\x13\n\x0b\x63hannel_tag\x18\x02 \x01(\x05"w\n\x1cSpeechRecognitionAlternative\x12\x12\n\ntranscript\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\x12/\n\x05words\x18\x03 \x03(\x0b\x32 .google.cloud.speech.v1.WordInfo"\x8e\x01\n\x08WordInfo\x12-\n\nstart_time\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12+\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x0c\n\x04word\x18\x03 \x01(\t\x12\x18\n\x0bspeaker_tag\x18\x05 \x01(\x05\x42\x03\xe0\x41\x03\x32\xd1\x04\n\x06Speech\x12\x90\x01\n\tRecognize\x12(.google.cloud.speech.v1.RecognizeRequest\x1a).google.cloud.speech.v1.RecognizeResponse".\x82\xd3\xe4\x93\x02\x19"\x14/v1/speech:recognize:\x01*\xda\x41\x0c\x63onfig,audio\x12\xe4\x01\n\x14LongRunningRecognize\x12\x33.google.cloud.speech.v1.LongRunningRecognizeRequest\x1a\x1d.google.longrunning.Operation"x\x82\xd3\xe4\x93\x02$"\x1f/v1/speech:longrunningrecognize:\x01*\xda\x41\x0c\x63onfig,audio\xca\x41<\n\x1cLongRunningRecognizeResponse\x12\x1cLongRunningRecognizeMetadata\x12\x81\x01\n\x12StreamingRecognize\x12\x31.google.cloud.speech.v1.StreamingRecognizeRequest\x1a\x32.google.cloud.speech.v1.StreamingRecognizeResponse"\x00(\x01\x30\x01\x1aI\xca\x41\x15speech.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformBr\n\x1a\x63om.google.cloud.speech.v1B\x0bSpeechProtoP\x01Z\n\x06\x63onfig\x18\x01 \x01(\x0b\x32).google.cloud.speech.v1.RecognitionConfigB\x03\xe0\x41\x02\x12<\n\x05\x61udio\x18\x02 \x01(\x0b\x32(.google.cloud.speech.v1.RecognitionAudioB\x03\xe0\x41\x02"\x9b\x01\n\x1bLongRunningRecognizeRequest\x12>\n\x06\x63onfig\x18\x01 \x01(\x0b\x32).google.cloud.speech.v1.RecognitionConfigB\x03\xe0\x41\x02\x12<\n\x05\x61udio\x18\x02 \x01(\x0b\x32(.google.cloud.speech.v1.RecognitionAudioB\x03\xe0\x41\x02"\x99\x01\n\x19StreamingRecognizeRequest\x12N\n\x10streaming_config\x18\x01 \x01(\x0b\x32\x32.google.cloud.speech.v1.StreamingRecognitionConfigH\x00\x12\x17\n\raudio_content\x18\x02 \x01(\x0cH\x00\x42\x13\n\x11streaming_request"\x8f\x01\n\x1aStreamingRecognitionConfig\x12>\n\x06\x63onfig\x18\x01 \x01(\x0b\x32).google.cloud.speech.v1.RecognitionConfigB\x03\xe0\x41\x02\x12\x18\n\x10single_utterance\x18\x02 \x01(\x08\x12\x17\n\x0finterim_results\x18\x03 \x01(\x08"\xdf\x05\n\x11RecognitionConfig\x12I\n\x08\x65ncoding\x18\x01 \x01(\x0e\x32\x37.google.cloud.speech.v1.RecognitionConfig.AudioEncoding\x12\x19\n\x11sample_rate_hertz\x18\x02 \x01(\x05\x12\x1b\n\x13\x61udio_channel_count\x18\x07 \x01(\x05\x12/\n\'enable_separate_recognition_per_channel\x18\x0c \x01(\x08\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x18\n\x10max_alternatives\x18\x04 \x01(\x05\x12\x18\n\x10profanity_filter\x18\x05 \x01(\x08\x12>\n\x0fspeech_contexts\x18\x06 \x03(\x0b\x32%.google.cloud.speech.v1.SpeechContext\x12 \n\x18\x65nable_word_time_offsets\x18\x08 \x01(\x08\x12$\n\x1c\x65nable_automatic_punctuation\x18\x0b \x01(\x08\x12L\n\x12\x64iarization_config\x18\x13 \x01(\x0b\x32\x30.google.cloud.speech.v1.SpeakerDiarizationConfig\x12=\n\x08metadata\x18\t \x01(\x0b\x32+.google.cloud.speech.v1.RecognitionMetadata\x12\r\n\x05model\x18\r \x01(\t\x12\x14\n\x0cuse_enhanced\x18\x0e \x01(\x08"\x8b\x01\n\rAudioEncoding\x12\x18\n\x14\x45NCODING_UNSPECIFIED\x10\x00\x12\x0c\n\x08LINEAR16\x10\x01\x12\x08\n\x04\x46LAC\x10\x02\x12\t\n\x05MULAW\x10\x03\x12\x07\n\x03\x41MR\x10\x04\x12\n\n\x06\x41MR_WB\x10\x05\x12\x0c\n\x08OGG_OPUS\x10\x06\x12\x1a\n\x16SPEEX_WITH_HEADER_BYTE\x10\x07"\x90\x01\n\x18SpeakerDiarizationConfig\x12"\n\x1a\x65nable_speaker_diarization\x18\x01 \x01(\x08\x12\x19\n\x11min_speaker_count\x18\x02 \x01(\x05\x12\x19\n\x11max_speaker_count\x18\x03 \x01(\x05\x12\x1a\n\x0bspeaker_tag\x18\x05 \x01(\x05\x42\x05\x18\x01\xe0\x41\x03"\xa0\x08\n\x13RecognitionMetadata\x12U\n\x10interaction_type\x18\x01 \x01(\x0e\x32;.google.cloud.speech.v1.RecognitionMetadata.InteractionType\x12$\n\x1cindustry_naics_code_of_audio\x18\x03 \x01(\r\x12[\n\x13microphone_distance\x18\x04 \x01(\x0e\x32>.google.cloud.speech.v1.RecognitionMetadata.MicrophoneDistance\x12Z\n\x13original_media_type\x18\x05 \x01(\x0e\x32=.google.cloud.speech.v1.RecognitionMetadata.OriginalMediaType\x12^\n\x15recording_device_type\x18\x06 \x01(\x0e\x32?.google.cloud.speech.v1.RecognitionMetadata.RecordingDeviceType\x12\x1d\n\x15recording_device_name\x18\x07 \x01(\t\x12\x1a\n\x12original_mime_type\x18\x08 \x01(\t\x12\x13\n\x0b\x61udio_topic\x18\n \x01(\t"\xc5\x01\n\x0fInteractionType\x12 \n\x1cINTERACTION_TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nDISCUSSION\x10\x01\x12\x10\n\x0cPRESENTATION\x10\x02\x12\x0e\n\nPHONE_CALL\x10\x03\x12\r\n\tVOICEMAIL\x10\x04\x12\x1b\n\x17PROFESSIONALLY_PRODUCED\x10\x05\x12\x10\n\x0cVOICE_SEARCH\x10\x06\x12\x11\n\rVOICE_COMMAND\x10\x07\x12\r\n\tDICTATION\x10\x08"d\n\x12MicrophoneDistance\x12#\n\x1fMICROPHONE_DISTANCE_UNSPECIFIED\x10\x00\x12\r\n\tNEARFIELD\x10\x01\x12\x0c\n\x08MIDFIELD\x10\x02\x12\x0c\n\x08\x46\x41RFIELD\x10\x03"N\n\x11OriginalMediaType\x12#\n\x1fORIGINAL_MEDIA_TYPE_UNSPECIFIED\x10\x00\x12\t\n\x05\x41UDIO\x10\x01\x12\t\n\x05VIDEO\x10\x02"\xa4\x01\n\x13RecordingDeviceType\x12%\n!RECORDING_DEVICE_TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nSMARTPHONE\x10\x01\x12\x06\n\x02PC\x10\x02\x12\x0e\n\nPHONE_LINE\x10\x03\x12\x0b\n\x07VEHICLE\x10\x04\x12\x18\n\x14OTHER_OUTDOOR_DEVICE\x10\x05\x12\x17\n\x13OTHER_INDOOR_DEVICE\x10\x06" \n\rSpeechContext\x12\x0f\n\x07phrases\x18\x01 \x03(\t"D\n\x10RecognitionAudio\x12\x11\n\x07\x63ontent\x18\x01 \x01(\x0cH\x00\x12\r\n\x03uri\x18\x02 \x01(\tH\x00\x42\x0e\n\x0c\x61udio_source"U\n\x11RecognizeResponse\x12@\n\x07results\x18\x02 \x03(\x0b\x32/.google.cloud.speech.v1.SpeechRecognitionResult"`\n\x1cLongRunningRecognizeResponse\x12@\n\x07results\x18\x02 \x03(\x0b\x32/.google.cloud.speech.v1.SpeechRecognitionResult"\x9e\x01\n\x1cLongRunningRecognizeMetadata\x12\x18\n\x10progress_percent\x18\x01 \x01(\x05\x12.\n\nstart_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x34\n\x10last_update_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\xb1\x02\n\x1aStreamingRecognizeResponse\x12!\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x12.google.rpc.Status\x12\x43\n\x07results\x18\x02 \x03(\x0b\x32\x32.google.cloud.speech.v1.StreamingRecognitionResult\x12]\n\x11speech_event_type\x18\x04 \x01(\x0e\x32\x42.google.cloud.speech.v1.StreamingRecognizeResponse.SpeechEventType"L\n\x0fSpeechEventType\x12\x1c\n\x18SPEECH_EVENT_UNSPECIFIED\x10\x00\x12\x1b\n\x17\x45ND_OF_SINGLE_UTTERANCE\x10\x01"\xf2\x01\n\x1aStreamingRecognitionResult\x12J\n\x0c\x61lternatives\x18\x01 \x03(\x0b\x32\x34.google.cloud.speech.v1.SpeechRecognitionAlternative\x12\x10\n\x08is_final\x18\x02 \x01(\x08\x12\x11\n\tstability\x18\x03 \x01(\x02\x12\x32\n\x0fresult_end_time\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x13\n\x0b\x63hannel_tag\x18\x05 \x01(\x05\x12\x1a\n\rlanguage_code\x18\x06 \x01(\tB\x03\xe0\x41\x03"z\n\x17SpeechRecognitionResult\x12J\n\x0c\x61lternatives\x18\x01 \x03(\x0b\x32\x34.google.cloud.speech.v1.SpeechRecognitionAlternative\x12\x13\n\x0b\x63hannel_tag\x18\x02 \x01(\x05"w\n\x1cSpeechRecognitionAlternative\x12\x12\n\ntranscript\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\x12/\n\x05words\x18\x03 \x03(\x0b\x32 .google.cloud.speech.v1.WordInfo"\x8e\x01\n\x08WordInfo\x12-\n\nstart_time\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12+\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x0c\n\x04word\x18\x03 \x01(\t\x12\x18\n\x0bspeaker_tag\x18\x05 \x01(\x05\x42\x03\xe0\x41\x03\x32\xd1\x04\n\x06Speech\x12\x90\x01\n\tRecognize\x12(.google.cloud.speech.v1.RecognizeRequest\x1a).google.cloud.speech.v1.RecognizeResponse".\x82\xd3\xe4\x93\x02\x19"\x14/v1/speech:recognize:\x01*\xda\x41\x0c\x63onfig,audio\x12\xe4\x01\n\x14LongRunningRecognize\x12\x33.google.cloud.speech.v1.LongRunningRecognizeRequest\x1a\x1d.google.longrunning.Operation"x\x82\xd3\xe4\x93\x02$"\x1f/v1/speech:longrunningrecognize:\x01*\xda\x41\x0c\x63onfig,audio\xca\x41<\n\x1cLongRunningRecognizeResponse\x12\x1cLongRunningRecognizeMetadata\x12\x81\x01\n\x12StreamingRecognize\x12\x31.google.cloud.speech.v1.StreamingRecognizeRequest\x1a\x32.google.cloud.speech.v1.StreamingRecognizeResponse"\x00(\x01\x30\x01\x1aI\xca\x41\x15speech.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformBr\n\x1a\x63om.google.cloud.speech.v1B\x0bSpeechProtoP\x01Z`__. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1.StreamingRecognizeRequest) - ), + }, ) _sym_db.RegisterMessage(StreamingRecognizeRequest) StreamingRecognitionConfig = _reflection.GeneratedProtocolMessageType( "StreamingRecognitionConfig", (_message.Message,), - dict( - DESCRIPTOR=_STREAMINGRECOGNITIONCONFIG, - __module__="google.cloud.speech_v1.proto.cloud_speech_pb2", - __doc__="""Provides information to the recognizer that specifies how - to process the request. - + { + "DESCRIPTOR": _STREAMINGRECOGNITIONCONFIG, + "__module__": "google.cloud.speech_v1.proto.cloud_speech_pb2", + "__doc__": """Provides information to the recognizer that specifies how to process + the request. Attributes: config: @@ -1999,19 +2196,18 @@ omitted, only ``is_final=true`` result(s) are returned. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1.StreamingRecognitionConfig) - ), + }, ) _sym_db.RegisterMessage(StreamingRecognitionConfig) RecognitionConfig = _reflection.GeneratedProtocolMessageType( "RecognitionConfig", (_message.Message,), - dict( - DESCRIPTOR=_RECOGNITIONCONFIG, - __module__="google.cloud.speech_v1.proto.cloud_speech_pb2", - __doc__="""Provides information to the recognizer that specifies how - to process the request. - + { + "DESCRIPTOR": _RECOGNITIONCONFIG, + "__module__": "google.cloud.speech_v1.proto.cloud_speech_pb2", + "__doc__": """Provides information to the recognizer that specifies how to process + the request. Attributes: encoding: @@ -2024,7 +2220,7 @@ Sample rate in Hertz of the audio data sent in all ``RecognitionAudio`` messages. Valid values are: 8000-48000. 16000 is optimal. For best results, set the sampling rate of - the audio source to 16000 Hz. If that's not possible, use the + the audio source to 16000 Hz. If that’s not possible, use the native sample rate of the audio source (instead of re- sampling). This field is optional for FLAC and WAV audio files, but is required for all other audio formats. For @@ -2033,13 +2229,12 @@ audio_channel_count: The number of channels in the input audio data. ONLY set this for MULTI-CHANNEL recognition. Valid values for LINEAR16 and - FLAC are ``1``-``8``. Valid values for OGG\_OPUS are - '1'-'254'. Valid value for MULAW, AMR, AMR\_WB and - SPEEX\_WITH\_HEADER\_BYTE is only ``1``. If ``0`` or omitted, - defaults to one channel (mono). Note: We only recognize the - first channel by default. To perform independent recognition - on each channel set - ``enable_separate_recognition_per_channel`` to 'true'. + FLAC are ``1``-``8``. Valid values for OGG_OPUS are ‘1’-‘254’. + Valid value for MULAW, AMR, AMR_WB and SPEEX_WITH_HEADER_BYTE + is only ``1``. If ``0`` or omitted, defaults to one channel + (mono). Note: We only recognize the first channel by default. + To perform independent recognition on each channel set + ``enable_separate_recognition_per_channel`` to ‘true’. enable_separate_recognition_per_channel: This needs to be set to ``true`` explicitly and ``audio_channel_count`` > 1 to get each channel recognized @@ -2052,7 +2247,7 @@ language_code: Required. The language of the supplied audio as a `BCP-47 `__ language - tag. Example: "en-US". See `Language Support + tag. Example: “en-US”. See `Language Support `__ for a list of the currently supported language codes. max_alternatives: @@ -2066,8 +2261,8 @@ profanity_filter: If set to ``true``, the server will attempt to filter out profanities, replacing all but the initial character in each - filtered word with asterisks, e.g. "f\*\*\*". If set to - ``false`` or omitted, profanities won't be filtered out. + filtered word with asterisks, e.g. "f***". If set to ``false`` + or omitted, profanities won’t be filtered out. speech_contexts: Array of [SpeechContext][google.cloud.speech.v1.SpeechContext]. A means @@ -2081,10 +2276,10 @@ ``false``, no word-level time offset information is returned. The default is ``false``. enable_automatic_punctuation: - If 'true', adds punctuation to recognition result hypotheses. + If ‘true’, adds punctuation to recognition result hypotheses. This feature is only available in select languages. Setting this for requests in other languages has no effect at all. The - default 'false' value does not add punctuation to result + default ‘false’ value does not add punctuation to result hypotheses. Note: This is currently offered as an experimental service, complimentary to all users. In the future this may be exclusively available as a premium feature. @@ -2105,26 +2300,29 @@ best suited to your domain to get best results. If a model is not explicitly specified, then we auto-select a model based on the parameters in the RecognitionConfig. .. raw:: html - .. raw:: html :: - .. raw:: html .. raw:: - html :: - .. - raw:: html .. raw:: html :: - .. raw:: html .. raw:: - html :: - .. - raw:: html .. raw:: html :: - .. raw:: - html .. raw:: html
ModelDescription
command_and_search Best for - short queries such as voice commands or voice search.
phone_call Best for audio that - originated from a phone call (typically recorded at an - 8khz sampling rate).
videoBest for audio that originated from from video or includes - multiple speakers. Ideally the audio is recorded at a - 16khz or greater sampling rate. This is a premium - model that costs more than the standard rate.
default Best for audio that is - not one of the specific audio models. For example, - long-form audio. Ideally the audio is high-fidelity, - recorded at a 16khz or greater sampling rate.
+ .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: + html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. + raw:: html .. + raw:: html .. raw:: html .. raw:: html + .. raw:: html + .. raw:: html .. raw:: html .. raw:: html + .. raw:: html + .. raw:: html .. raw:: html + .. raw:: html
Model + .. raw:: html Description + .. raw:: html
command_and_search .. + raw:: html Best for short + queries such as voice commands or voice search. .. raw:: html +
phone_call .. raw:: html Best for audio that originated from a + phone call (typically recorded at an 8khz sampling rate). .. + raw:: html
video .. raw:: html Best for audio that originated from + from video or includes multiple speakers. Ideally the audio is + recorded at a 16khz or greater sampling rate. This is a + premium model that costs more than the standard rate. .. + raw:: html
default .. raw:: html Best for audio that is not one of the + specific audio models. For example, long-form audio. Ideally + the audio is high-fidelity, recorded at a 16khz or greater + sampling rate. .. raw:: html
use_enhanced: Set to true to use an enhanced model for speech recognition. If ``use_enhanced`` is set to true and the ``model`` field is @@ -2135,24 +2333,23 @@ version of the specified model. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1.RecognitionConfig) - ), + }, ) _sym_db.RegisterMessage(RecognitionConfig) SpeakerDiarizationConfig = _reflection.GeneratedProtocolMessageType( "SpeakerDiarizationConfig", (_message.Message,), - dict( - DESCRIPTOR=_SPEAKERDIARIZATIONCONFIG, - __module__="google.cloud.speech_v1.proto.cloud_speech_pb2", - __doc__="""Config to enable speaker diarization. - + { + "DESCRIPTOR": _SPEAKERDIARIZATIONCONFIG, + "__module__": "google.cloud.speech_v1.proto.cloud_speech_pb2", + "__doc__": """Config to enable speaker diarization. Attributes: enable_speaker_diarization: - If 'true', enables speaker detection for each recognized word + If ‘true’, enables speaker detection for each recognized word in the top alternative of the recognition result using a - speaker\_tag provided in the WordInfo. + speaker_tag provided in the WordInfo. min_speaker_count: Minimum number of speakers in the conversation. This range gives you more flexibility by allowing the system to @@ -2167,18 +2364,17 @@ Unused. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1.SpeakerDiarizationConfig) - ), + }, ) _sym_db.RegisterMessage(SpeakerDiarizationConfig) RecognitionMetadata = _reflection.GeneratedProtocolMessageType( "RecognitionMetadata", (_message.Message,), - dict( - DESCRIPTOR=_RECOGNITIONMETADATA, - __module__="google.cloud.speech_v1.proto.cloud_speech_pb2", - __doc__="""Description of audio data to be recognized. - + { + "DESCRIPTOR": _RECOGNITIONMETADATA, + "__module__": "google.cloud.speech_v1.proto.cloud_speech_pb2", + "__doc__": """Description of audio data to be recognized. Attributes: interaction_type: @@ -2197,9 +2393,9 @@ recording_device_type: The type of device the speech was recorded with. recording_device_name: - The device used to make the recording. Examples 'Nexus 5X' or - 'Polycom SoundStation IP 6000' or 'POTS' or 'VoIP' or - 'Cardioid Microphone'. + The device used to make the recording. Examples ‘Nexus 5X’ or + ‘Polycom SoundStation IP 6000’ or ‘POTS’ or ‘VoIP’ or + ‘Cardioid Microphone’. original_mime_type: Mime type of the original audio file. For example ``audio/m4a``, ``audio/x-alaw-basic``, ``audio/mp3``, @@ -2207,27 +2403,26 @@ maintained at http://www.iana.org/assignments/media- types/media-types.xhtml#audio audio_topic: - Description of the content. Eg. "Recordings of federal supreme - court hearings from 2012". + Description of the content. Eg. “Recordings of federal supreme + court hearings from 2012”. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1.RecognitionMetadata) - ), + }, ) _sym_db.RegisterMessage(RecognitionMetadata) SpeechContext = _reflection.GeneratedProtocolMessageType( "SpeechContext", (_message.Message,), - dict( - DESCRIPTOR=_SPEECHCONTEXT, - __module__="google.cloud.speech_v1.proto.cloud_speech_pb2", - __doc__="""Provides "hints" to the speech recognizer to favor - specific words and phrases in the results. - + { + "DESCRIPTOR": _SPEECHCONTEXT, + "__module__": "google.cloud.speech_v1.proto.cloud_speech_pb2", + "__doc__": """Provides “hints” to the speech recognizer to favor specific words and + phrases in the results. Attributes: phrases: - A list of strings containing words and phrases "hints" so that + A list of strings containing words and phrases “hints” so that the speech recognition is more likely to recognize them. This can be used to improve the accuracy for specific words and phrases, for example, if specific commands are typically @@ -2241,23 +2436,22 @@ correctly transcribing audio that includes months. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1.SpeechContext) - ), + }, ) _sym_db.RegisterMessage(SpeechContext) RecognitionAudio = _reflection.GeneratedProtocolMessageType( "RecognitionAudio", (_message.Message,), - dict( - DESCRIPTOR=_RECOGNITIONAUDIO, - __module__="google.cloud.speech_v1.proto.cloud_speech_pb2", - __doc__="""Contains audio data in the encoding specified in the + { + "DESCRIPTOR": _RECOGNITIONAUDIO, + "__module__": "google.cloud.speech_v1.proto.cloud_speech_pb2", + "__doc__": """Contains audio data in the encoding specified in the ``RecognitionConfig``. Either ``content`` or ``uri`` must be supplied. Supplying both or neither returns - [google.rpc.Code.INVALID\_ARGUMENT][google.rpc.Code.INVALID\_ARGUMENT]. - See `content - limits `__. - + [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + See `content limits `__. Attributes: audio_source: @@ -2274,73 +2468,70 @@ compressed (for example, gzip). Currently, only Google Cloud Storage URIs are supported, which must be specified in the following format: ``gs://bucket_name/object_name`` (other URI - formats return [google.rpc.Code.INVALID\_ARGUMENT][google.rpc. - Code.INVALID\_ARGUMENT]). For more information, see `Request + formats return [google.rpc.Code.INVALID_ARGUMENT][google.rpc.C + ode.INVALID_ARGUMENT]). For more information, see `Request URIs `__. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1.RecognitionAudio) - ), + }, ) _sym_db.RegisterMessage(RecognitionAudio) RecognizeResponse = _reflection.GeneratedProtocolMessageType( "RecognizeResponse", (_message.Message,), - dict( - DESCRIPTOR=_RECOGNIZERESPONSE, - __module__="google.cloud.speech_v1.proto.cloud_speech_pb2", - __doc__="""The only message returned to the client by the - ``Recognize`` method. It contains the result as zero or more sequential + { + "DESCRIPTOR": _RECOGNIZERESPONSE, + "__module__": "google.cloud.speech_v1.proto.cloud_speech_pb2", + "__doc__": """The only message returned to the client by the ``Recognize`` method. + It contains the result as zero or more sequential ``SpeechRecognitionResult`` messages. - Attributes: results: Sequential list of transcription results corresponding to sequential portions of audio. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1.RecognizeResponse) - ), + }, ) _sym_db.RegisterMessage(RecognizeResponse) LongRunningRecognizeResponse = _reflection.GeneratedProtocolMessageType( "LongRunningRecognizeResponse", (_message.Message,), - dict( - DESCRIPTOR=_LONGRUNNINGRECOGNIZERESPONSE, - __module__="google.cloud.speech_v1.proto.cloud_speech_pb2", - __doc__="""The only message returned to the client by the - ``LongRunningRecognize`` method. It contains the result as zero or more - sequential ``SpeechRecognitionResult`` messages. It is included in the - ``result.response`` field of the ``Operation`` returned by the + { + "DESCRIPTOR": _LONGRUNNINGRECOGNIZERESPONSE, + "__module__": "google.cloud.speech_v1.proto.cloud_speech_pb2", + "__doc__": """The only message returned to the client by the + ``LongRunningRecognize`` method. It contains the result as zero or + more sequential ``SpeechRecognitionResult`` messages. It is included + in the ``result.response`` field of the ``Operation`` returned by the ``GetOperation`` call of the ``google::longrunning::Operations`` service. - Attributes: results: Sequential list of transcription results corresponding to sequential portions of audio. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1.LongRunningRecognizeResponse) - ), + }, ) _sym_db.RegisterMessage(LongRunningRecognizeResponse) LongRunningRecognizeMetadata = _reflection.GeneratedProtocolMessageType( "LongRunningRecognizeMetadata", (_message.Message,), - dict( - DESCRIPTOR=_LONGRUNNINGRECOGNIZEMETADATA, - __module__="google.cloud.speech_v1.proto.cloud_speech_pb2", - __doc__="""Describes the progress of a long-running - ``LongRunningRecognize`` call. It is included in the ``metadata`` field - of the ``Operation`` returned by the ``GetOperation`` call of the + { + "DESCRIPTOR": _LONGRUNNINGRECOGNIZEMETADATA, + "__module__": "google.cloud.speech_v1.proto.cloud_speech_pb2", + "__doc__": """Describes the progress of a long-running ``LongRunningRecognize`` + call. It is included in the ``metadata`` field of the ``Operation`` + returned by the ``GetOperation`` call of the ``google::longrunning::Operations`` service. - Attributes: progress_percent: Approximate percentage of audio processed thus far. Guaranteed @@ -2352,66 +2543,47 @@ Time of the most recent processing update. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1.LongRunningRecognizeMetadata) - ), + }, ) _sym_db.RegisterMessage(LongRunningRecognizeMetadata) StreamingRecognizeResponse = _reflection.GeneratedProtocolMessageType( "StreamingRecognizeResponse", (_message.Message,), - dict( - DESCRIPTOR=_STREAMINGRECOGNIZERESPONSE, - __module__="google.cloud.speech_v1.proto.cloud_speech_pb2", - __doc__="""\ ``StreamingRecognizeResponse`` is the only message - returned to the client by ``StreamingRecognize``. A series of zero or - more ``StreamingRecognizeResponse`` messages are streamed back to the + { + "DESCRIPTOR": _STREAMINGRECOGNIZERESPONSE, + "__module__": "google.cloud.speech_v1.proto.cloud_speech_pb2", + "__doc__": """\ ``StreamingRecognizeResponse`` is the only message returned to the + client by ``StreamingRecognize``. A series of zero or more + ``StreamingRecognizeResponse`` messages are streamed back to the client. If there is no recognizable audio, and ``single_utterance`` is set to false, then no messages are streamed back to the client. - - Here's an example of a series of ten ``StreamingRecognizeResponse``\ s - that might be returned while processing audio: - - 1. results { alternatives { transcript: "tube" } stability: 0.01 } - - 2. results { alternatives { transcript: "to be a" } stability: 0.01 } - - 3. results { alternatives { transcript: "to be" } stability: 0.9 } - results { alternatives { transcript: " or not to be" } stability: - 0.01 } - - 4. results { alternatives { transcript: "to be or not to be" confidence: - 0.92 } alternatives { transcript: "to bee or not to bee" } is\_final: - true } - - 5. results { alternatives { transcript: " that's" } stability: 0.01 } - - 6. results { alternatives { transcript: " that is" } stability: 0.9 } - results { alternatives { transcript: " the question" } stability: - 0.01 } - - 7. results { alternatives { transcript: " that is the question" - confidence: 0.98 } alternatives { transcript: " that was the - question" } is\_final: true } - - Notes: - - - Only two of the above responses #4 and #7 contain final results; they - are indicated by ``is_final: true``. Concatenating these together - generates the full transcript: "to be or not to be that is the - question". - - - The others contain interim ``results``. #3 and #6 contain two interim - ``results``: the first portion has a high stability and is less - likely to change; the second portion has a low stability and is very - likely to change. A UI designer might choose to show only high - stability ``results``. - - - The specific ``stability`` and ``confidence`` values shown above are - only for illustrative purposes. Actual values may vary. - - - In each response, only one of these fields will be set: ``error``, - ``speech_event_type``, or one or more (repeated) ``results``. - + Here’s an example of a series of ten ``StreamingRecognizeResponse``\ s + that might be returned while processing audio: 1. results { + alternatives { transcript: “tube” } stability: 0.01 } 2. results { + alternatives { transcript: “to be a” } stability: 0.01 } 3. results { + alternatives { transcript: “to be” } stability: 0.9 } results { + alternatives { transcript: " or not to be" } stability: 0.01 } 4. + results { alternatives { transcript: “to be or not to be” confidence: + 0.92 } alternatives { transcript: “to bee or not to bee” } is_final: + true } 5. results { alternatives { transcript: " that’s" } stability: + 0.01 } 6. results { alternatives { transcript: " that is" } + stability: 0.9 } results { alternatives { transcript: " the + question" } stability: 0.01 } 7. results { alternatives { + transcript: " that is the question" confidence: 0.98 } alternatives + { transcript: " that was the question" } is_final: true } Notes: + - Only two of the above responses #4 and #7 contain final results; + they are indicated by ``is_final: true``. Concatenating these + together generates the full transcript: “to be or not to be that is + the question”. - The others contain interim ``results``. #3 and + #6 contain two interim ``results``: the first portion has a high + stability and is less likely to change; the second portion has a + low stability and is very likely to change. A UI designer might + choose to show only high stability ``results``. - The specific + ``stability`` and ``confidence`` values shown above are only for + illustrative purposes. Actual values may vary. - In each response, + only one of these fields will be set: ``error``, + ``speech_event_type``, or one or more (repeated) ``results``. Attributes: error: @@ -2427,19 +2599,18 @@ Indicates the type of speech event. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1.StreamingRecognizeResponse) - ), + }, ) _sym_db.RegisterMessage(StreamingRecognizeResponse) StreamingRecognitionResult = _reflection.GeneratedProtocolMessageType( "StreamingRecognitionResult", (_message.Message,), - dict( - DESCRIPTOR=_STREAMINGRECOGNITIONRESULT, - __module__="google.cloud.speech_v1.proto.cloud_speech_pb2", - __doc__="""A streaming speech recognition result corresponding to a - portion of the audio that is currently being processed. - + { + "DESCRIPTOR": _STREAMINGRECOGNITIONRESULT, + "__module__": "google.cloud.speech_v1.proto.cloud_speech_pb2", + "__doc__": """A streaming speech recognition result corresponding to a portion of + the audio that is currently being processed. Attributes: alternatives: @@ -2468,8 +2639,8 @@ channel_tag: For multi-channel audio, this is the channel number corresponding to the recognized result for the audio from that - channel. For audio\_channel\_count = N, its output values can - range from '1' to 'N'. + channel. For audio_channel_count = N, its output values can + range from ‘1’ to ‘N’. language_code: The `BCP-47 `__ language tag of the language in this result. This language @@ -2477,19 +2648,17 @@ in the audio. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1.StreamingRecognitionResult) - ), + }, ) _sym_db.RegisterMessage(StreamingRecognitionResult) SpeechRecognitionResult = _reflection.GeneratedProtocolMessageType( "SpeechRecognitionResult", (_message.Message,), - dict( - DESCRIPTOR=_SPEECHRECOGNITIONRESULT, - __module__="google.cloud.speech_v1.proto.cloud_speech_pb2", - __doc__="""A speech recognition result corresponding to a portion of - the audio. - + { + "DESCRIPTOR": _SPEECHRECOGNITIONRESULT, + "__module__": "google.cloud.speech_v1.proto.cloud_speech_pb2", + "__doc__": """A speech recognition result corresponding to a portion of the audio. Attributes: alternatives: @@ -2501,22 +2670,21 @@ channel_tag: For multi-channel audio, this is the channel number corresponding to the recognized result for the audio from that - channel. For audio\_channel\_count = N, its output values can - range from '1' to 'N'. + channel. For audio_channel_count = N, its output values can + range from ‘1’ to ‘N’. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1.SpeechRecognitionResult) - ), + }, ) _sym_db.RegisterMessage(SpeechRecognitionResult) SpeechRecognitionAlternative = _reflection.GeneratedProtocolMessageType( "SpeechRecognitionAlternative", (_message.Message,), - dict( - DESCRIPTOR=_SPEECHRECOGNITIONALTERNATIVE, - __module__="google.cloud.speech_v1.proto.cloud_speech_pb2", - __doc__="""Alternative hypotheses (a.k.a. n-best list). - + { + "DESCRIPTOR": _SPEECHRECOGNITIONALTERNATIVE, + "__module__": "google.cloud.speech_v1.proto.cloud_speech_pb2", + "__doc__": """Alternative hypotheses (a.k.a. n-best list). Attributes: transcript: @@ -2536,18 +2704,17 @@ see all the words from the beginning of the audio. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1.SpeechRecognitionAlternative) - ), + }, ) _sym_db.RegisterMessage(SpeechRecognitionAlternative) WordInfo = _reflection.GeneratedProtocolMessageType( "WordInfo", (_message.Message,), - dict( - DESCRIPTOR=_WORDINFO, - __module__="google.cloud.speech_v1.proto.cloud_speech_pb2", - __doc__="""Word-specific information for recognized words. - + { + "DESCRIPTOR": _WORDINFO, + "__module__": "google.cloud.speech_v1.proto.cloud_speech_pb2", + "__doc__": """Word-specific information for recognized words. Attributes: start_time: @@ -2567,13 +2734,13 @@ speaker_tag: A distinct integer value is assigned for every speaker within the audio. This field specifies which one of those speakers - was detected to have spoken this word. Value ranges from '1' - to diarization\_speaker\_count. speaker\_tag is set if - enable\_speaker\_diarization = 'true' and only in the top + was detected to have spoken this word. Value ranges from ‘1’ + to diarization_speaker_count. speaker_tag is set if + enable_speaker_diarization = ‘true’ and only in the top alternative. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1.WordInfo) - ), + }, ) _sym_db.RegisterMessage(WordInfo) @@ -2594,9 +2761,8 @@ full_name="google.cloud.speech.v1.Speech", file=DESCRIPTOR, index=0, - serialized_options=_b( - "\312A\025speech.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform" - ), + serialized_options=b"\312A\025speech.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform", + create_key=_descriptor._internal_create_key, serialized_start=4262, serialized_end=4855, methods=[ @@ -2607,9 +2773,8 @@ containing_service=None, input_type=_RECOGNIZEREQUEST, output_type=_RECOGNIZERESPONSE, - serialized_options=_b( - '\202\323\344\223\002\031"\024/v1/speech:recognize:\001*\332A\014config,audio' - ), + serialized_options=b'\202\323\344\223\002\031"\024/v1/speech:recognize:\001*\332A\014config,audio', + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="LongRunningRecognize", @@ -2618,9 +2783,8 @@ containing_service=None, input_type=_LONGRUNNINGRECOGNIZEREQUEST, output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=_b( - '\202\323\344\223\002$"\037/v1/speech:longrunningrecognize:\001*\332A\014config,audio\312A<\n\034LongRunningRecognizeResponse\022\034LongRunningRecognizeMetadata' - ), + serialized_options=b'\202\323\344\223\002$"\037/v1/speech:longrunningrecognize:\001*\332A\014config,audio\312A<\n\034LongRunningRecognizeResponse\022\034LongRunningRecognizeMetadata', + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="StreamingRecognize", @@ -2630,6 +2794,7 @@ input_type=_STREAMINGRECOGNIZEREQUEST, output_type=_STREAMINGRECOGNIZERESPONSE, serialized_options=None, + create_key=_descriptor._internal_create_key, ), ], ) diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1/proto/cloud_speech_pb2_grpc.py b/packages/google-cloud-python-speech/google/cloud/speech_v1/proto/cloud_speech_pb2_grpc.py index a7ddcb9c8865..e56beb6de3b6 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1/proto/cloud_speech_pb2_grpc.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1/proto/cloud_speech_pb2_grpc.py @@ -1,4 +1,5 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" import grpc from google.cloud.speech_v1.proto import ( @@ -11,14 +12,14 @@ class SpeechStub(object): """Service that implements Google Cloud Speech API. - """ + """ def __init__(self, channel): """Constructor. - Args: - channel: A grpc.Channel. - """ + Args: + channel: A grpc.Channel. + """ self.Recognize = channel.unary_unary( "/google.cloud.speech.v1.Speech/Recognize", request_serializer=google_dot_cloud_dot_speech__v1_dot_proto_dot_cloud__speech__pb2.RecognizeRequest.SerializeToString, @@ -38,32 +39,32 @@ def __init__(self, channel): class SpeechServicer(object): """Service that implements Google Cloud Speech API. - """ + """ def Recognize(self, request, context): """Performs synchronous speech recognition: receive results after all audio - has been sent and processed. - """ + has been sent and processed. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def LongRunningRecognize(self, request, context): """Performs asynchronous speech recognition: receive results via the - google.longrunning.Operations interface. Returns either an - `Operation.error` or an `Operation.response` which contains - a `LongRunningRecognizeResponse` message. - For more information on asynchronous speech recognition, see the - [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize). - """ + google.longrunning.Operations interface. Returns either an + `Operation.error` or an `Operation.response` which contains + a `LongRunningRecognizeResponse` message. + For more information on asynchronous speech recognition, see the + [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize). + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def StreamingRecognize(self, request_iterator, context): """Performs bidirectional streaming speech recognition: receive results while - sending audio. This method is only available via the gRPC API (not REST). - """ + sending audio. This method is only available via the gRPC API (not REST). + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") @@ -91,3 +92,90 @@ def add_SpeechServicer_to_server(servicer, server): "google.cloud.speech.v1.Speech", rpc_method_handlers ) server.add_generic_rpc_handlers((generic_handler,)) + + +# This class is part of an EXPERIMENTAL API. +class Speech(object): + """Service that implements Google Cloud Speech API. + """ + + @staticmethod + def Recognize( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.speech.v1.Speech/Recognize", + google_dot_cloud_dot_speech__v1_dot_proto_dot_cloud__speech__pb2.RecognizeRequest.SerializeToString, + google_dot_cloud_dot_speech__v1_dot_proto_dot_cloud__speech__pb2.RecognizeResponse.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def LongRunningRecognize( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.speech.v1.Speech/LongRunningRecognize", + google_dot_cloud_dot_speech__v1_dot_proto_dot_cloud__speech__pb2.LongRunningRecognizeRequest.SerializeToString, + google_dot_longrunning_dot_operations__pb2.Operation.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def StreamingRecognize( + request_iterator, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.stream_stream( + request_iterator, + target, + "/google.cloud.speech.v1.Speech/StreamingRecognize", + google_dot_cloud_dot_speech__v1_dot_proto_dot_cloud__speech__pb2.StreamingRecognizeRequest.SerializeToString, + google_dot_cloud_dot_speech__v1_dot_proto_dot_cloud__speech__pb2.StreamingRecognizeResponse.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1/types.py b/packages/google-cloud-python-speech/google/cloud/speech_v1/types.py index f2bd717a7a06..2f486e2500db 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1/types.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1/types.py @@ -28,9 +28,17 @@ from google.rpc import status_pb2 -_shared_modules = [operations_pb2, any_pb2, duration_pb2, timestamp_pb2, status_pb2] - -_local_modules = [cloud_speech_pb2] +_shared_modules = [ + operations_pb2, + any_pb2, + duration_pb2, + timestamp_pb2, + status_pb2, +] + +_local_modules = [ + cloud_speech_pb2, +] names = [] diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/gapic/enums.py b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/gapic/enums.py index 3616356fa51d..b17772ec15ef 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/gapic/enums.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/gapic/enums.py @@ -49,20 +49,21 @@ class AudioEncoding(enum.IntEnum): Attributes: ENCODING_UNSPECIFIED (int): Not specified. LINEAR16 (int): Uncompressed 16-bit signed little-endian samples (Linear PCM). - FLAC (int): ``FLAC`` (Free Lossless Audio Codec) is the recommended encoding because - it is lossless--therefore recognition is not compromised--and requires - only about half the bandwidth of ``LINEAR16``. ``FLAC`` stream encoding - supports 16-bit and 24-bit samples, however, not all fields in + FLAC (int): ``FLAC`` (Free Lossless Audio Codec) is the recommended encoding + because it is lossless--therefore recognition is not compromised--and + requires only about half the bandwidth of ``LINEAR16``. ``FLAC`` stream + encoding supports 16-bit and 24-bit samples, however, not all fields in ``STREAMINFO`` are supported. MULAW (int): 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. AMR (int): Adaptive Multi-Rate Narrowband codec. ``sample_rate_hertz`` must be 8000. - AMR_WB (int): Adaptive Multi-Rate Wideband codec. ``sample_rate_hertz`` must be 16000. + AMR_WB (int): Adaptive Multi-Rate Wideband codec. ``sample_rate_hertz`` must be + 16000. OGG_OPUS (int): Opus encoded audio frames in Ogg container (`OggOpus `__). ``sample_rate_hertz`` must be one of 8000, 12000, 16000, 24000, or 48000. - SPEEX_WITH_HEADER_BYTE (int): Although the use of lossy encodings is not recommended, if a very low - bitrate encoding is required, ``OGG_OPUS`` is highly preferred over + SPEEX_WITH_HEADER_BYTE (int): Although the use of lossy encodings is not recommended, if a very + low bitrate encoding is required, ``OGG_OPUS`` is highly preferred over Speex encoding. The `Speex `__ encoding supported by Cloud Speech API has a header byte in each block, as in MIME type ``audio/x-speex-with-header-byte``. It is a variant of the RTP Speex @@ -73,9 +74,9 @@ class AudioEncoding(enum.IntEnum): number of bytes (octets) as specified in RFC 5574. In other words, each RTP header is replaced with a single byte containing the block length. Only Speex wideband is supported. ``sample_rate_hertz`` must be 16000. - MP3 (int): MP3 audio. Support all standard MP3 bitrates (which range from 32-320 - kbps). When using this encoding, ``sample_rate_hertz`` can be optionally - unset if not known. + MP3 (int): MP3 audio. Support all standard MP3 bitrates (which range from + 32-320 kbps). When using this encoding, ``sample_rate_hertz`` has to + match the sample rate of the file being used. """ ENCODING_UNSPECIFIED = 0 @@ -101,7 +102,7 @@ class InteractionType(enum.IntEnum): DISCUSSION (int): Multiple people in a conversation or discussion. For example in a meeting with two or more people actively participating. Typically all the primary people speaking would be in the same room (if not, see - PHONE\_CALL) + PHONE_CALL) PRESENTATION (int): One or more persons lecturing or presenting to others, mostly uninterrupted. PHONE_CALL (int): A phone-call or video-conference in which two or more people, who are @@ -186,11 +187,11 @@ class SpeechEventType(enum.IntEnum): Attributes: SPEECH_EVENT_UNSPECIFIED (int): No speech event specified. - END_OF_SINGLE_UTTERANCE (int): This event indicates that the server has detected the end of the user's - speech utterance and expects no additional speech. Therefore, the server - will not process additional audio (although it may subsequently return - additional results). The client should stop sending additional audio - data, half-close the gRPC connection, and wait for any additional + END_OF_SINGLE_UTTERANCE (int): This event indicates that the server has detected the end of the + user's speech utterance and expects no additional speech. Therefore, the + server will not process additional audio (although it may subsequently + return additional results). The client should stop sending additional + audio data, half-close the gRPC connection, and wait for any additional results until the server closes the gRPC connection. This event is only sent if ``single_utterance`` was set to ``true``, and is not used otherwise. diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/gapic/speech_client.py b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/gapic/speech_client.py index 5703df5b84a0..1ee874bc8bb9 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/gapic/speech_client.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/gapic/speech_client.py @@ -38,7 +38,7 @@ from google.longrunning import operations_pb2 -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-speech").version +_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-speech",).version class SpeechClient(object): @@ -158,12 +158,12 @@ def __init__( self.transport = transport else: self.transport = speech_grpc_transport.SpeechGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials + address=api_endpoint, channel=channel, credentials=credentials, ) if client_info is None: client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION + gapic_version=_GAPIC_LIBRARY_VERSION, ) else: client_info.gapic_version = _GAPIC_LIBRARY_VERSION @@ -174,7 +174,7 @@ def __init__( # (Ordinarily, these are the defaults specified in the `*_config.py` # file next to this one.) self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME] + client_config["interfaces"][self._INTERFACE_NAME], ) # Save a dictionary of cached API call functions. @@ -251,7 +251,7 @@ def recognize( client_info=self._client_info, ) - request = cloud_speech_pb2.RecognizeRequest(config=config, audio=audio) + request = cloud_speech_pb2.RecognizeRequest(config=config, audio=audio,) return self._inner_api_calls["recognize"]( request, retry=retry, timeout=timeout, metadata=metadata ) @@ -337,7 +337,7 @@ def long_running_recognize( ) request = cloud_speech_pb2.LongRunningRecognizeRequest( - config=config, audio=audio + config=config, audio=audio, ) operation = self._inner_api_calls["long_running_recognize"]( request, retry=retry, timeout=timeout, metadata=metadata @@ -360,8 +360,6 @@ def streaming_recognize( Performs bidirectional streaming speech recognition: receive results while sending audio. This method is only available via the gRPC API (not REST). - EXPERIMENTAL: This method interface might change in the future. - Example: >>> from google.cloud import speech_v1p1beta1 >>> diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/gapic/speech_client_config.py b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/gapic/speech_client_config.py index c405dd03f430..722aa5653899 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/gapic/speech_client_config.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/gapic/speech_client_config.py @@ -2,35 +2,54 @@ "interfaces": { "google.cloud.speech.v1p1beta1.Speech": { "retry_codes": { - "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "non_idempotent": [], + "retry_policy_1_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], + "no_retry_codes": [], + "no_retry_1_codes": [], }, "retry_params": { - "default": { + "retry_policy_1_params": { "initial_retry_delay_millis": 100, "retry_delay_multiplier": 1.3, "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 1000000, + "initial_rpc_timeout_millis": 5000000, "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 1000000, + "max_rpc_timeout_millis": 5000000, "total_timeout_millis": 5000000, - } + }, + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0, + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 5000000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 5000000, + "total_timeout_millis": 5000000, + }, }, "methods": { "Recognize": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", + "timeout_millis": 5000000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params", }, "LongRunningRecognize": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", + "timeout_millis": 5000000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params", }, "StreamingRecognize": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", + "timeout_millis": 5000000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params", }, }, } diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/gapic/transports/speech_grpc_transport.py b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/gapic/transports/speech_grpc_transport.py index a8e42b09157f..382f53c1aa54 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/gapic/transports/speech_grpc_transport.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/gapic/transports/speech_grpc_transport.py @@ -54,7 +54,7 @@ def __init__( # exception (channels come with credentials baked in already). if channel is not None and credentials is not None: raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive." + "The `channel` and `credentials` arguments are mutually " "exclusive.", ) # Create the channel. @@ -72,7 +72,9 @@ def __init__( # gRPC uses objects called "stubs" that are bound to the # channel and provide a basic method for each RPC. - self._stubs = {"speech_stub": cloud_speech_pb2_grpc.SpeechStub(channel)} + self._stubs = { + "speech_stub": cloud_speech_pb2_grpc.SpeechStub(channel), + } # Because this API includes a method that returns a # long-running operation (proto: google.longrunning.Operation), diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/cloud_speech.proto b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/cloud_speech.proto index 7718b0eb3cf2..7bb12866b63a 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/cloud_speech.proto +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/cloud_speech.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// syntax = "proto3"; @@ -20,6 +19,8 @@ package google.cloud.speech.v1p1beta1; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/speech/v1p1beta1/resource.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/any.proto"; import "google/protobuf/duration.proto"; @@ -36,7 +37,8 @@ option objc_class_prefix = "GCS"; // Service that implements Google Cloud Speech API. service Speech { option (google.api.default_host) = "speech.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; // Performs synchronous speech recognition: receive results after all audio // has been sent and processed. @@ -54,7 +56,8 @@ service Speech { // a `LongRunningRecognizeResponse` message. // For more information on asynchronous speech recognition, see the // [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize). - rpc LongRunningRecognize(LongRunningRecognizeRequest) returns (google.longrunning.Operation) { + rpc LongRunningRecognize(LongRunningRecognizeRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v1p1beta1/speech:longrunningrecognize" body: "*" @@ -68,8 +71,8 @@ service Speech { // Performs bidirectional streaming speech recognition: receive results while // sending audio. This method is only available via the gRPC API (not REST). - rpc StreamingRecognize(stream StreamingRecognizeRequest) returns (stream StreamingRecognizeResponse) { - } + rpc StreamingRecognize(stream StreamingRecognizeRequest) + returns (stream StreamingRecognizeResponse) {} } // The top-level message sent by the client for the `Recognize` method. @@ -169,7 +172,8 @@ message RecognitionConfig { // an `AudioEncoding` when you send send `FLAC` or `WAV` audio, the // encoding configuration must match the encoding described in the audio // header; otherwise the request returns an - // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error code. + // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error + // code. enum AudioEncoding { // Not specified. ENCODING_UNSPECIFIED = 0; @@ -215,14 +219,15 @@ message RecognitionConfig { SPEEX_WITH_HEADER_BYTE = 7; // MP3 audio. Support all standard MP3 bitrates (which range from 32-320 - // kbps). When using this encoding, `sample_rate_hertz` can be optionally - // unset if not known. + // kbps). When using this encoding, `sample_rate_hertz` has to match the + // sample rate of the file being used. MP3 = 8; } // Encoding of audio data sent in all `RecognitionAudio` messages. // This field is optional for `FLAC` and `WAV` audio files and required - // for all other audio formats. For details, see [AudioEncoding][google.cloud.speech.v1p1beta1.RecognitionConfig.AudioEncoding]. + // for all other audio formats. For details, see + // [AudioEncoding][google.cloud.speech.v1p1beta1.RecognitionConfig.AudioEncoding]. AudioEncoding encoding = 1; // Sample rate in Hertz of the audio data sent in all @@ -231,7 +236,8 @@ message RecognitionConfig { // source to 16000 Hz. If that's not possible, use the native sample rate of // the audio source (instead of re-sampling). // This field is optional for FLAC and WAV audio files, but is - // required for all other audio formats. For details, see [AudioEncoding][google.cloud.speech.v1p1beta1.RecognitionConfig.AudioEncoding]. + // required for all other audio formats. For details, see + // [AudioEncoding][google.cloud.speech.v1p1beta1.RecognitionConfig.AudioEncoding]. int32 sample_rate_hertz = 2; // The number of channels in the input audio data. @@ -289,6 +295,13 @@ message RecognitionConfig { // won't be filtered out. bool profanity_filter = 5; + // Speech adaptation configuration improves the accuracy of speech + // recognition. When speech adaptation is set it supersedes the + // `speech_contexts` field. For more information, see the [speech + // adaptation](https://cloud.google.com/speech-to-text/docs/context-strength) + // documentation. + SpeechAdaptation adaptation = 20; + // Array of [SpeechContext][google.cloud.speech.v1p1beta1.SpeechContext]. // A means to provide context to assist the speech recognition. For more // information, see @@ -311,9 +324,6 @@ message RecognitionConfig { // This feature is only available in select languages. Setting this for // requests in other languages has no effect at all. // The default 'false' value does not add punctuation to result hypotheses. - // Note: This is currently offered as an experimental service, complimentary - // to all users. In the future this may be exclusively available as a - // premium feature. bool enable_automatic_punctuation = 11; // If 'true', enables speaker detection for each recognized word in @@ -401,6 +411,10 @@ message SpeakerDiarizationConfig { // flexibility by allowing the system to automatically determine the correct // number of speakers. If not set, the default value is 6. int32 max_speaker_count = 3; + + // Output only. Unused. + int32 speaker_tag = 5 + [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY]; } // Description of audio data to be recognized. @@ -564,8 +578,8 @@ message SpeechContext { // Contains audio data in the encoding specified in the `RecognitionConfig`. // Either `content` or `uri` must be supplied. Supplying both or neither -// returns [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. See -// [content limits](https://cloud.google.com/speech-to-text/quotas#content). +// returns [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. +// See [content limits](https://cloud.google.com/speech-to-text/quotas#content). message RecognitionAudio { // The audio source, which is either inline content or a Google Cloud // Storage uri. @@ -580,8 +594,9 @@ message RecognitionAudio { // Currently, only Google Cloud Storage URIs are // supported, which must be specified in the following format: // `gs://bucket_name/object_name` (other URI formats return - // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see - // [Request URIs](https://cloud.google.com/storage/docs/reference-uris). + // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). + // For more information, see [Request + // URIs](https://cloud.google.com/storage/docs/reference-uris). string uri = 2; } } @@ -619,6 +634,10 @@ message LongRunningRecognizeMetadata { // Time of the most recent processing update. google.protobuf.Timestamp last_update_time = 3; + + // The URI of the audio file being transcribed. Empty if the audio was sent + // as byte content. + string uri = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; } // `StreamingRecognizeResponse` is the only message returned to the client by @@ -732,10 +751,10 @@ message StreamingRecognitionResult { // For audio_channel_count = N, its output values can range from '1' to 'N'. int32 channel_tag = 5; - // The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag - // of the language in this result. This language code was detected to have - // the most likelihood of being spoken in the audio. - string language_code = 6; + // Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + // language tag of the language in this result. This language code was + // detected to have the most likelihood of being spoken in the audio. + string language_code = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; } // A speech recognition result corresponding to a portion of the audio. @@ -751,10 +770,10 @@ message SpeechRecognitionResult { // For audio_channel_count = N, its output values can range from '1' to 'N'. int32 channel_tag = 2; - // The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag - // of the language in this result. This language code was detected to have - // the most likelihood of being spoken in the audio. - string language_code = 5; + // Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + // language tag of the language in this result. This language code was + // detected to have the most likelihood of being spoken in the audio. + string language_code = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; } // Alternative hypotheses (a.k.a. n-best list). @@ -807,10 +826,10 @@ message WordInfo { // The default of 0.0 is a sentinel value indicating `confidence` was not set. float confidence = 4; - // A distinct integer value is assigned for every speaker within + // Output only. A distinct integer value is assigned for every speaker within // the audio. This field specifies which one of those speakers was detected to // have spoken this word. Value ranges from '1' to diarization_speaker_count. // speaker_tag is set if enable_speaker_diarization = 'true' and only in the // top alternative. - int32 speaker_tag = 5; + int32 speaker_tag = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; } diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/cloud_speech_pb2.py b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/cloud_speech_pb2.py index 1fd8de4ffbe8..c79941862be7 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/cloud_speech_pb2.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/cloud_speech_pb2.py @@ -1,10 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/speech_v1p1beta1/proto/cloud_speech.proto - -import sys - -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection @@ -18,6 +15,10 @@ from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 from google.api import client_pb2 as google_dot_api_dot_client__pb2 from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 +from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 +from google.cloud.speech_v1p1beta1.proto import ( + resource_pb2 as google_dot_cloud_dot_speech__v1p1beta1_dot_proto_dot_resource__pb2, +) from google.longrunning import ( operations_pb2 as google_dot_longrunning_dot_operations__pb2, ) @@ -31,16 +32,15 @@ name="google/cloud/speech_v1p1beta1/proto/cloud_speech.proto", package="google.cloud.speech.v1p1beta1", syntax="proto3", - serialized_options=_b( - "\n!com.google.cloud.speech.v1p1beta1B\013SpeechProtoP\001ZCgoogle.golang.org/genproto/googleapis/cloud/speech/v1p1beta1;speech\370\001\001\242\002\003GCS" - ), - serialized_pb=_b( - '\n6google/cloud/speech_v1p1beta1/proto/cloud_speech.proto\x12\x1dgoogle.cloud.speech.v1p1beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a#google/longrunning/operations.proto\x1a\x19google/protobuf/any.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto"\x9e\x01\n\x10RecognizeRequest\x12\x45\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\x30.google.cloud.speech.v1p1beta1.RecognitionConfigB\x03\xe0\x41\x02\x12\x43\n\x05\x61udio\x18\x02 \x01(\x0b\x32/.google.cloud.speech.v1p1beta1.RecognitionAudioB\x03\xe0\x41\x02"\xa9\x01\n\x1bLongRunningRecognizeRequest\x12\x45\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\x30.google.cloud.speech.v1p1beta1.RecognitionConfigB\x03\xe0\x41\x02\x12\x43\n\x05\x61udio\x18\x02 \x01(\x0b\x32/.google.cloud.speech.v1p1beta1.RecognitionAudioB\x03\xe0\x41\x02"\xa0\x01\n\x19StreamingRecognizeRequest\x12U\n\x10streaming_config\x18\x01 \x01(\x0b\x32\x39.google.cloud.speech.v1p1beta1.StreamingRecognitionConfigH\x00\x12\x17\n\raudio_content\x18\x02 \x01(\x0cH\x00\x42\x13\n\x11streaming_request"\x96\x01\n\x1aStreamingRecognitionConfig\x12\x45\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\x30.google.cloud.speech.v1p1beta1.RecognitionConfigB\x03\xe0\x41\x02\x12\x18\n\x10single_utterance\x18\x02 \x01(\x08\x12\x17\n\x0finterim_results\x18\x03 \x01(\x08"\x97\x07\n\x11RecognitionConfig\x12P\n\x08\x65ncoding\x18\x01 \x01(\x0e\x32>.google.cloud.speech.v1p1beta1.RecognitionConfig.AudioEncoding\x12\x19\n\x11sample_rate_hertz\x18\x02 \x01(\x05\x12\x1b\n\x13\x61udio_channel_count\x18\x07 \x01(\x05\x12/\n\'enable_separate_recognition_per_channel\x18\x0c \x01(\x08\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12"\n\x1a\x61lternative_language_codes\x18\x12 \x03(\t\x12\x18\n\x10max_alternatives\x18\x04 \x01(\x05\x12\x18\n\x10profanity_filter\x18\x05 \x01(\x08\x12\x45\n\x0fspeech_contexts\x18\x06 \x03(\x0b\x32,.google.cloud.speech.v1p1beta1.SpeechContext\x12 \n\x18\x65nable_word_time_offsets\x18\x08 \x01(\x08\x12\x1e\n\x16\x65nable_word_confidence\x18\x0f \x01(\x08\x12$\n\x1c\x65nable_automatic_punctuation\x18\x0b \x01(\x08\x12&\n\x1a\x65nable_speaker_diarization\x18\x10 \x01(\x08\x42\x02\x18\x01\x12%\n\x19\x64iarization_speaker_count\x18\x11 \x01(\x05\x42\x02\x18\x01\x12S\n\x12\x64iarization_config\x18\x13 \x01(\x0b\x32\x37.google.cloud.speech.v1p1beta1.SpeakerDiarizationConfig\x12\x44\n\x08metadata\x18\t \x01(\x0b\x32\x32.google.cloud.speech.v1p1beta1.RecognitionMetadata\x12\r\n\x05model\x18\r \x01(\t\x12\x14\n\x0cuse_enhanced\x18\x0e \x01(\x08"\x94\x01\n\rAudioEncoding\x12\x18\n\x14\x45NCODING_UNSPECIFIED\x10\x00\x12\x0c\n\x08LINEAR16\x10\x01\x12\x08\n\x04\x46LAC\x10\x02\x12\t\n\x05MULAW\x10\x03\x12\x07\n\x03\x41MR\x10\x04\x12\n\n\x06\x41MR_WB\x10\x05\x12\x0c\n\x08OGG_OPUS\x10\x06\x12\x1a\n\x16SPEEX_WITH_HEADER_BYTE\x10\x07\x12\x07\n\x03MP3\x10\x08"t\n\x18SpeakerDiarizationConfig\x12"\n\x1a\x65nable_speaker_diarization\x18\x01 \x01(\x08\x12\x19\n\x11min_speaker_count\x18\x02 \x01(\x05\x12\x19\n\x11max_speaker_count\x18\x03 \x01(\x05"\xd7\x08\n\x13RecognitionMetadata\x12\\\n\x10interaction_type\x18\x01 \x01(\x0e\x32\x42.google.cloud.speech.v1p1beta1.RecognitionMetadata.InteractionType\x12$\n\x1cindustry_naics_code_of_audio\x18\x03 \x01(\r\x12\x62\n\x13microphone_distance\x18\x04 \x01(\x0e\x32\x45.google.cloud.speech.v1p1beta1.RecognitionMetadata.MicrophoneDistance\x12\x61\n\x13original_media_type\x18\x05 \x01(\x0e\x32\x44.google.cloud.speech.v1p1beta1.RecognitionMetadata.OriginalMediaType\x12\x65\n\x15recording_device_type\x18\x06 \x01(\x0e\x32\x46.google.cloud.speech.v1p1beta1.RecognitionMetadata.RecordingDeviceType\x12\x1d\n\x15recording_device_name\x18\x07 \x01(\t\x12\x1a\n\x12original_mime_type\x18\x08 \x01(\t\x12\x19\n\robfuscated_id\x18\t \x01(\x03\x42\x02\x18\x01\x12\x13\n\x0b\x61udio_topic\x18\n \x01(\t"\xc5\x01\n\x0fInteractionType\x12 \n\x1cINTERACTION_TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nDISCUSSION\x10\x01\x12\x10\n\x0cPRESENTATION\x10\x02\x12\x0e\n\nPHONE_CALL\x10\x03\x12\r\n\tVOICEMAIL\x10\x04\x12\x1b\n\x17PROFESSIONALLY_PRODUCED\x10\x05\x12\x10\n\x0cVOICE_SEARCH\x10\x06\x12\x11\n\rVOICE_COMMAND\x10\x07\x12\r\n\tDICTATION\x10\x08"d\n\x12MicrophoneDistance\x12#\n\x1fMICROPHONE_DISTANCE_UNSPECIFIED\x10\x00\x12\r\n\tNEARFIELD\x10\x01\x12\x0c\n\x08MIDFIELD\x10\x02\x12\x0c\n\x08\x46\x41RFIELD\x10\x03"N\n\x11OriginalMediaType\x12#\n\x1fORIGINAL_MEDIA_TYPE_UNSPECIFIED\x10\x00\x12\t\n\x05\x41UDIO\x10\x01\x12\t\n\x05VIDEO\x10\x02"\xa4\x01\n\x13RecordingDeviceType\x12%\n!RECORDING_DEVICE_TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nSMARTPHONE\x10\x01\x12\x06\n\x02PC\x10\x02\x12\x0e\n\nPHONE_LINE\x10\x03\x12\x0b\n\x07VEHICLE\x10\x04\x12\x18\n\x14OTHER_OUTDOOR_DEVICE\x10\x05\x12\x17\n\x13OTHER_INDOOR_DEVICE\x10\x06"/\n\rSpeechContext\x12\x0f\n\x07phrases\x18\x01 \x03(\t\x12\r\n\x05\x62oost\x18\x04 \x01(\x02"D\n\x10RecognitionAudio\x12\x11\n\x07\x63ontent\x18\x01 \x01(\x0cH\x00\x12\r\n\x03uri\x18\x02 \x01(\tH\x00\x42\x0e\n\x0c\x61udio_source"\\\n\x11RecognizeResponse\x12G\n\x07results\x18\x02 \x03(\x0b\x32\x36.google.cloud.speech.v1p1beta1.SpeechRecognitionResult"g\n\x1cLongRunningRecognizeResponse\x12G\n\x07results\x18\x02 \x03(\x0b\x32\x36.google.cloud.speech.v1p1beta1.SpeechRecognitionResult"\x9e\x01\n\x1cLongRunningRecognizeMetadata\x12\x18\n\x10progress_percent\x18\x01 \x01(\x05\x12.\n\nstart_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x34\n\x10last_update_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\xbf\x02\n\x1aStreamingRecognizeResponse\x12!\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x12.google.rpc.Status\x12J\n\x07results\x18\x02 \x03(\x0b\x32\x39.google.cloud.speech.v1p1beta1.StreamingRecognitionResult\x12\x64\n\x11speech_event_type\x18\x04 \x01(\x0e\x32I.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse.SpeechEventType"L\n\x0fSpeechEventType\x12\x1c\n\x18SPEECH_EVENT_UNSPECIFIED\x10\x00\x12\x1b\n\x17\x45ND_OF_SINGLE_UTTERANCE\x10\x01"\xf4\x01\n\x1aStreamingRecognitionResult\x12Q\n\x0c\x61lternatives\x18\x01 \x03(\x0b\x32;.google.cloud.speech.v1p1beta1.SpeechRecognitionAlternative\x12\x10\n\x08is_final\x18\x02 \x01(\x08\x12\x11\n\tstability\x18\x03 \x01(\x02\x12\x32\n\x0fresult_end_time\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x13\n\x0b\x63hannel_tag\x18\x05 \x01(\x05\x12\x15\n\rlanguage_code\x18\x06 \x01(\t"\x98\x01\n\x17SpeechRecognitionResult\x12Q\n\x0c\x61lternatives\x18\x01 \x03(\x0b\x32;.google.cloud.speech.v1p1beta1.SpeechRecognitionAlternative\x12\x13\n\x0b\x63hannel_tag\x18\x02 \x01(\x05\x12\x15\n\rlanguage_code\x18\x05 \x01(\t"~\n\x1cSpeechRecognitionAlternative\x12\x12\n\ntranscript\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\x12\x36\n\x05words\x18\x03 \x03(\x0b\x32\'.google.cloud.speech.v1p1beta1.WordInfo"\x9d\x01\n\x08WordInfo\x12-\n\nstart_time\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12+\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x0c\n\x04word\x18\x03 \x01(\t\x12\x12\n\nconfidence\x18\x04 \x01(\x02\x12\x13\n\x0bspeaker_tag\x18\x05 \x01(\x05\x32\x82\x05\n\x06Speech\x12\xa5\x01\n\tRecognize\x12/.google.cloud.speech.v1p1beta1.RecognizeRequest\x1a\x30.google.cloud.speech.v1p1beta1.RecognizeResponse"5\x82\xd3\xe4\x93\x02 "\x1b/v1p1beta1/speech:recognize:\x01*\xda\x41\x0c\x63onfig,audio\x12\xf2\x01\n\x14LongRunningRecognize\x12:.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest\x1a\x1d.google.longrunning.Operation"\x7f\x82\xd3\xe4\x93\x02+"&/v1p1beta1/speech:longrunningrecognize:\x01*\xda\x41\x0c\x63onfig,audio\xca\x41<\n\x1cLongRunningRecognizeResponse\x12\x1cLongRunningRecognizeMetadata\x12\x8f\x01\n\x12StreamingRecognize\x12\x38.google.cloud.speech.v1p1beta1.StreamingRecognizeRequest\x1a\x39.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse"\x00(\x01\x30\x01\x1aI\xca\x41\x15speech.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\x80\x01\n!com.google.cloud.speech.v1p1beta1B\x0bSpeechProtoP\x01ZCgoogle.golang.org/genproto/googleapis/cloud/speech/v1p1beta1;speech\xf8\x01\x01\xa2\x02\x03GCSb\x06proto3' - ), + serialized_options=b"\n!com.google.cloud.speech.v1p1beta1B\013SpeechProtoP\001ZCgoogle.golang.org/genproto/googleapis/cloud/speech/v1p1beta1;speech\370\001\001\242\002\003GCS", + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n6google/cloud/speech_v1p1beta1/proto/cloud_speech.proto\x12\x1dgoogle.cloud.speech.v1p1beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x32google/cloud/speech_v1p1beta1/proto/resource.proto\x1a#google/longrunning/operations.proto\x1a\x19google/protobuf/any.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/rpc/status.proto"\x9e\x01\n\x10RecognizeRequest\x12\x45\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\x30.google.cloud.speech.v1p1beta1.RecognitionConfigB\x03\xe0\x41\x02\x12\x43\n\x05\x61udio\x18\x02 \x01(\x0b\x32/.google.cloud.speech.v1p1beta1.RecognitionAudioB\x03\xe0\x41\x02"\xa9\x01\n\x1bLongRunningRecognizeRequest\x12\x45\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\x30.google.cloud.speech.v1p1beta1.RecognitionConfigB\x03\xe0\x41\x02\x12\x43\n\x05\x61udio\x18\x02 \x01(\x0b\x32/.google.cloud.speech.v1p1beta1.RecognitionAudioB\x03\xe0\x41\x02"\xa0\x01\n\x19StreamingRecognizeRequest\x12U\n\x10streaming_config\x18\x01 \x01(\x0b\x32\x39.google.cloud.speech.v1p1beta1.StreamingRecognitionConfigH\x00\x12\x17\n\raudio_content\x18\x02 \x01(\x0cH\x00\x42\x13\n\x11streaming_request"\x96\x01\n\x1aStreamingRecognitionConfig\x12\x45\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\x30.google.cloud.speech.v1p1beta1.RecognitionConfigB\x03\xe0\x41\x02\x12\x18\n\x10single_utterance\x18\x02 \x01(\x08\x12\x17\n\x0finterim_results\x18\x03 \x01(\x08"\xdc\x07\n\x11RecognitionConfig\x12P\n\x08\x65ncoding\x18\x01 \x01(\x0e\x32>.google.cloud.speech.v1p1beta1.RecognitionConfig.AudioEncoding\x12\x19\n\x11sample_rate_hertz\x18\x02 \x01(\x05\x12\x1b\n\x13\x61udio_channel_count\x18\x07 \x01(\x05\x12/\n\'enable_separate_recognition_per_channel\x18\x0c \x01(\x08\x12\x1a\n\rlanguage_code\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12"\n\x1a\x61lternative_language_codes\x18\x12 \x03(\t\x12\x18\n\x10max_alternatives\x18\x04 \x01(\x05\x12\x18\n\x10profanity_filter\x18\x05 \x01(\x08\x12\x43\n\nadaptation\x18\x14 \x01(\x0b\x32/.google.cloud.speech.v1p1beta1.SpeechAdaptation\x12\x45\n\x0fspeech_contexts\x18\x06 \x03(\x0b\x32,.google.cloud.speech.v1p1beta1.SpeechContext\x12 \n\x18\x65nable_word_time_offsets\x18\x08 \x01(\x08\x12\x1e\n\x16\x65nable_word_confidence\x18\x0f \x01(\x08\x12$\n\x1c\x65nable_automatic_punctuation\x18\x0b \x01(\x08\x12&\n\x1a\x65nable_speaker_diarization\x18\x10 \x01(\x08\x42\x02\x18\x01\x12%\n\x19\x64iarization_speaker_count\x18\x11 \x01(\x05\x42\x02\x18\x01\x12S\n\x12\x64iarization_config\x18\x13 \x01(\x0b\x32\x37.google.cloud.speech.v1p1beta1.SpeakerDiarizationConfig\x12\x44\n\x08metadata\x18\t \x01(\x0b\x32\x32.google.cloud.speech.v1p1beta1.RecognitionMetadata\x12\r\n\x05model\x18\r \x01(\t\x12\x14\n\x0cuse_enhanced\x18\x0e \x01(\x08"\x94\x01\n\rAudioEncoding\x12\x18\n\x14\x45NCODING_UNSPECIFIED\x10\x00\x12\x0c\n\x08LINEAR16\x10\x01\x12\x08\n\x04\x46LAC\x10\x02\x12\t\n\x05MULAW\x10\x03\x12\x07\n\x03\x41MR\x10\x04\x12\n\n\x06\x41MR_WB\x10\x05\x12\x0c\n\x08OGG_OPUS\x10\x06\x12\x1a\n\x16SPEEX_WITH_HEADER_BYTE\x10\x07\x12\x07\n\x03MP3\x10\x08"\x90\x01\n\x18SpeakerDiarizationConfig\x12"\n\x1a\x65nable_speaker_diarization\x18\x01 \x01(\x08\x12\x19\n\x11min_speaker_count\x18\x02 \x01(\x05\x12\x19\n\x11max_speaker_count\x18\x03 \x01(\x05\x12\x1a\n\x0bspeaker_tag\x18\x05 \x01(\x05\x42\x05\x18\x01\xe0\x41\x03"\xd7\x08\n\x13RecognitionMetadata\x12\\\n\x10interaction_type\x18\x01 \x01(\x0e\x32\x42.google.cloud.speech.v1p1beta1.RecognitionMetadata.InteractionType\x12$\n\x1cindustry_naics_code_of_audio\x18\x03 \x01(\r\x12\x62\n\x13microphone_distance\x18\x04 \x01(\x0e\x32\x45.google.cloud.speech.v1p1beta1.RecognitionMetadata.MicrophoneDistance\x12\x61\n\x13original_media_type\x18\x05 \x01(\x0e\x32\x44.google.cloud.speech.v1p1beta1.RecognitionMetadata.OriginalMediaType\x12\x65\n\x15recording_device_type\x18\x06 \x01(\x0e\x32\x46.google.cloud.speech.v1p1beta1.RecognitionMetadata.RecordingDeviceType\x12\x1d\n\x15recording_device_name\x18\x07 \x01(\t\x12\x1a\n\x12original_mime_type\x18\x08 \x01(\t\x12\x19\n\robfuscated_id\x18\t \x01(\x03\x42\x02\x18\x01\x12\x13\n\x0b\x61udio_topic\x18\n \x01(\t"\xc5\x01\n\x0fInteractionType\x12 \n\x1cINTERACTION_TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nDISCUSSION\x10\x01\x12\x10\n\x0cPRESENTATION\x10\x02\x12\x0e\n\nPHONE_CALL\x10\x03\x12\r\n\tVOICEMAIL\x10\x04\x12\x1b\n\x17PROFESSIONALLY_PRODUCED\x10\x05\x12\x10\n\x0cVOICE_SEARCH\x10\x06\x12\x11\n\rVOICE_COMMAND\x10\x07\x12\r\n\tDICTATION\x10\x08"d\n\x12MicrophoneDistance\x12#\n\x1fMICROPHONE_DISTANCE_UNSPECIFIED\x10\x00\x12\r\n\tNEARFIELD\x10\x01\x12\x0c\n\x08MIDFIELD\x10\x02\x12\x0c\n\x08\x46\x41RFIELD\x10\x03"N\n\x11OriginalMediaType\x12#\n\x1fORIGINAL_MEDIA_TYPE_UNSPECIFIED\x10\x00\x12\t\n\x05\x41UDIO\x10\x01\x12\t\n\x05VIDEO\x10\x02"\xa4\x01\n\x13RecordingDeviceType\x12%\n!RECORDING_DEVICE_TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nSMARTPHONE\x10\x01\x12\x06\n\x02PC\x10\x02\x12\x0e\n\nPHONE_LINE\x10\x03\x12\x0b\n\x07VEHICLE\x10\x04\x12\x18\n\x14OTHER_OUTDOOR_DEVICE\x10\x05\x12\x17\n\x13OTHER_INDOOR_DEVICE\x10\x06"/\n\rSpeechContext\x12\x0f\n\x07phrases\x18\x01 \x03(\t\x12\r\n\x05\x62oost\x18\x04 \x01(\x02"D\n\x10RecognitionAudio\x12\x11\n\x07\x63ontent\x18\x01 \x01(\x0cH\x00\x12\r\n\x03uri\x18\x02 \x01(\tH\x00\x42\x0e\n\x0c\x61udio_source"\\\n\x11RecognizeResponse\x12G\n\x07results\x18\x02 \x03(\x0b\x32\x36.google.cloud.speech.v1p1beta1.SpeechRecognitionResult"g\n\x1cLongRunningRecognizeResponse\x12G\n\x07results\x18\x02 \x03(\x0b\x32\x36.google.cloud.speech.v1p1beta1.SpeechRecognitionResult"\xb0\x01\n\x1cLongRunningRecognizeMetadata\x12\x18\n\x10progress_percent\x18\x01 \x01(\x05\x12.\n\nstart_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x34\n\x10last_update_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x10\n\x03uri\x18\x04 \x01(\tB\x03\xe0\x41\x03"\xbf\x02\n\x1aStreamingRecognizeResponse\x12!\n\x05\x65rror\x18\x01 \x01(\x0b\x32\x12.google.rpc.Status\x12J\n\x07results\x18\x02 \x03(\x0b\x32\x39.google.cloud.speech.v1p1beta1.StreamingRecognitionResult\x12\x64\n\x11speech_event_type\x18\x04 \x01(\x0e\x32I.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse.SpeechEventType"L\n\x0fSpeechEventType\x12\x1c\n\x18SPEECH_EVENT_UNSPECIFIED\x10\x00\x12\x1b\n\x17\x45ND_OF_SINGLE_UTTERANCE\x10\x01"\xf9\x01\n\x1aStreamingRecognitionResult\x12Q\n\x0c\x61lternatives\x18\x01 \x03(\x0b\x32;.google.cloud.speech.v1p1beta1.SpeechRecognitionAlternative\x12\x10\n\x08is_final\x18\x02 \x01(\x08\x12\x11\n\tstability\x18\x03 \x01(\x02\x12\x32\n\x0fresult_end_time\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x13\n\x0b\x63hannel_tag\x18\x05 \x01(\x05\x12\x1a\n\rlanguage_code\x18\x06 \x01(\tB\x03\xe0\x41\x03"\x9d\x01\n\x17SpeechRecognitionResult\x12Q\n\x0c\x61lternatives\x18\x01 \x03(\x0b\x32;.google.cloud.speech.v1p1beta1.SpeechRecognitionAlternative\x12\x13\n\x0b\x63hannel_tag\x18\x02 \x01(\x05\x12\x1a\n\rlanguage_code\x18\x05 \x01(\tB\x03\xe0\x41\x03"~\n\x1cSpeechRecognitionAlternative\x12\x12\n\ntranscript\x18\x01 \x01(\t\x12\x12\n\nconfidence\x18\x02 \x01(\x02\x12\x36\n\x05words\x18\x03 \x03(\x0b\x32\'.google.cloud.speech.v1p1beta1.WordInfo"\xa2\x01\n\x08WordInfo\x12-\n\nstart_time\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12+\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x0c\n\x04word\x18\x03 \x01(\t\x12\x12\n\nconfidence\x18\x04 \x01(\x02\x12\x18\n\x0bspeaker_tag\x18\x05 \x01(\x05\x42\x03\xe0\x41\x03\x32\x82\x05\n\x06Speech\x12\xa5\x01\n\tRecognize\x12/.google.cloud.speech.v1p1beta1.RecognizeRequest\x1a\x30.google.cloud.speech.v1p1beta1.RecognizeResponse"5\x82\xd3\xe4\x93\x02 "\x1b/v1p1beta1/speech:recognize:\x01*\xda\x41\x0c\x63onfig,audio\x12\xf2\x01\n\x14LongRunningRecognize\x12:.google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest\x1a\x1d.google.longrunning.Operation"\x7f\x82\xd3\xe4\x93\x02+"&/v1p1beta1/speech:longrunningrecognize:\x01*\xda\x41\x0c\x63onfig,audio\xca\x41<\n\x1cLongRunningRecognizeResponse\x12\x1cLongRunningRecognizeMetadata\x12\x8f\x01\n\x12StreamingRecognize\x12\x38.google.cloud.speech.v1p1beta1.StreamingRecognizeRequest\x1a\x39.google.cloud.speech.v1p1beta1.StreamingRecognizeResponse"\x00(\x01\x30\x01\x1aI\xca\x41\x15speech.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\x80\x01\n!com.google.cloud.speech.v1p1beta1B\x0bSpeechProtoP\x01ZCgoogle.golang.org/genproto/googleapis/cloud/speech/v1p1beta1;speech\xf8\x01\x01\xa2\x02\x03GCSb\x06proto3', dependencies=[ google_dot_api_dot_annotations__pb2.DESCRIPTOR, google_dot_api_dot_client__pb2.DESCRIPTOR, google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, + google_dot_api_dot_resource__pb2.DESCRIPTOR, + google_dot_cloud_dot_speech__v1p1beta1_dot_proto_dot_resource__pb2.DESCRIPTOR, google_dot_longrunning_dot_operations__pb2.DESCRIPTOR, google_dot_protobuf_dot_any__pb2.DESCRIPTOR, google_dot_protobuf_dot_duration__pb2.DESCRIPTOR, @@ -55,6 +55,7 @@ full_name="google.cloud.speech.v1p1beta1.RecognitionConfig.AudioEncoding", filename=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, values=[ _descriptor.EnumValueDescriptor( name="ENCODING_UNSPECIFIED", @@ -62,24 +63,55 @@ number=0, serialized_options=None, type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="LINEAR16", index=1, number=1, serialized_options=None, type=None + name="LINEAR16", + index=1, + number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="FLAC", index=2, number=2, serialized_options=None, type=None + name="FLAC", + index=2, + number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="MULAW", index=3, number=3, serialized_options=None, type=None + name="MULAW", + index=3, + number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="AMR", index=4, number=4, serialized_options=None, type=None + name="AMR", + index=4, + number=4, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="AMR_WB", index=5, number=5, serialized_options=None, type=None + name="AMR_WB", + index=5, + number=5, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="OGG_OPUS", index=6, number=6, serialized_options=None, type=None + name="OGG_OPUS", + index=6, + number=6, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( name="SPEEX_WITH_HEADER_BYTE", @@ -87,15 +119,21 @@ number=7, serialized_options=None, type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="MP3", index=8, number=8, serialized_options=None, type=None + name="MP3", + index=8, + number=8, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), ], containing_type=None, serialized_options=None, - serialized_start=1752, - serialized_end=1900, + serialized_start=1900, + serialized_end=2048, ) _sym_db.RegisterEnumDescriptor(_RECOGNITIONCONFIG_AUDIOENCODING) @@ -104,6 +142,7 @@ full_name="google.cloud.speech.v1p1beta1.RecognitionMetadata.InteractionType", filename=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, values=[ _descriptor.EnumValueDescriptor( name="INTERACTION_TYPE_UNSPECIFIED", @@ -111,18 +150,39 @@ number=0, serialized_options=None, type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="DISCUSSION", index=1, number=1, serialized_options=None, type=None + name="DISCUSSION", + index=1, + number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="PRESENTATION", index=2, number=2, serialized_options=None, type=None + name="PRESENTATION", + index=2, + number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="PHONE_CALL", index=3, number=3, serialized_options=None, type=None + name="PHONE_CALL", + index=3, + number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="VOICEMAIL", index=4, number=4, serialized_options=None, type=None + name="VOICEMAIL", + index=4, + number=4, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( name="PROFESSIONALLY_PRODUCED", @@ -130,21 +190,37 @@ number=5, serialized_options=None, type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="VOICE_SEARCH", index=6, number=6, serialized_options=None, type=None + name="VOICE_SEARCH", + index=6, + number=6, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="VOICE_COMMAND", index=7, number=7, serialized_options=None, type=None + name="VOICE_COMMAND", + index=7, + number=7, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="DICTATION", index=8, number=8, serialized_options=None, type=None + name="DICTATION", + index=8, + number=8, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), ], containing_type=None, serialized_options=None, - serialized_start=2586, - serialized_end=2783, + serialized_start=2763, + serialized_end=2960, ) _sym_db.RegisterEnumDescriptor(_RECOGNITIONMETADATA_INTERACTIONTYPE) @@ -153,6 +229,7 @@ full_name="google.cloud.speech.v1p1beta1.RecognitionMetadata.MicrophoneDistance", filename=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, values=[ _descriptor.EnumValueDescriptor( name="MICROPHONE_DISTANCE_UNSPECIFIED", @@ -160,21 +237,37 @@ number=0, serialized_options=None, type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="NEARFIELD", index=1, number=1, serialized_options=None, type=None + name="NEARFIELD", + index=1, + number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="MIDFIELD", index=2, number=2, serialized_options=None, type=None + name="MIDFIELD", + index=2, + number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="FARFIELD", index=3, number=3, serialized_options=None, type=None + name="FARFIELD", + index=3, + number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), ], containing_type=None, serialized_options=None, - serialized_start=2785, - serialized_end=2885, + serialized_start=2962, + serialized_end=3062, ) _sym_db.RegisterEnumDescriptor(_RECOGNITIONMETADATA_MICROPHONEDISTANCE) @@ -183,6 +276,7 @@ full_name="google.cloud.speech.v1p1beta1.RecognitionMetadata.OriginalMediaType", filename=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, values=[ _descriptor.EnumValueDescriptor( name="ORIGINAL_MEDIA_TYPE_UNSPECIFIED", @@ -190,18 +284,29 @@ number=0, serialized_options=None, type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="AUDIO", index=1, number=1, serialized_options=None, type=None + name="AUDIO", + index=1, + number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="VIDEO", index=2, number=2, serialized_options=None, type=None + name="VIDEO", + index=2, + number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), ], containing_type=None, serialized_options=None, - serialized_start=2887, - serialized_end=2965, + serialized_start=3064, + serialized_end=3142, ) _sym_db.RegisterEnumDescriptor(_RECOGNITIONMETADATA_ORIGINALMEDIATYPE) @@ -210,6 +315,7 @@ full_name="google.cloud.speech.v1p1beta1.RecognitionMetadata.RecordingDeviceType", filename=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, values=[ _descriptor.EnumValueDescriptor( name="RECORDING_DEVICE_TYPE_UNSPECIFIED", @@ -217,18 +323,39 @@ number=0, serialized_options=None, type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="SMARTPHONE", index=1, number=1, serialized_options=None, type=None + name="SMARTPHONE", + index=1, + number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="PC", index=2, number=2, serialized_options=None, type=None + name="PC", + index=2, + number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="PHONE_LINE", index=3, number=3, serialized_options=None, type=None + name="PHONE_LINE", + index=3, + number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( - name="VEHICLE", index=4, number=4, serialized_options=None, type=None + name="VEHICLE", + index=4, + number=4, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( name="OTHER_OUTDOOR_DEVICE", @@ -236,6 +363,7 @@ number=5, serialized_options=None, type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( name="OTHER_INDOOR_DEVICE", @@ -243,12 +371,13 @@ number=6, serialized_options=None, type=None, + create_key=_descriptor._internal_create_key, ), ], containing_type=None, serialized_options=None, - serialized_start=2968, - serialized_end=3132, + serialized_start=3145, + serialized_end=3309, ) _sym_db.RegisterEnumDescriptor(_RECOGNITIONMETADATA_RECORDINGDEVICETYPE) @@ -257,6 +386,7 @@ full_name="google.cloud.speech.v1p1beta1.StreamingRecognizeResponse.SpeechEventType", filename=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, values=[ _descriptor.EnumValueDescriptor( name="SPEECH_EVENT_UNSPECIFIED", @@ -264,6 +394,7 @@ number=0, serialized_options=None, type=None, + create_key=_descriptor._internal_create_key, ), _descriptor.EnumValueDescriptor( name="END_OF_SINGLE_UTTERANCE", @@ -271,12 +402,13 @@ number=1, serialized_options=None, type=None, + create_key=_descriptor._internal_create_key, ), ], containing_type=None, serialized_options=None, - serialized_start=3857, - serialized_end=3933, + serialized_start=4052, + serialized_end=4128, ) _sym_db.RegisterEnumDescriptor(_STREAMINGRECOGNIZERESPONSE_SPEECHEVENTTYPE) @@ -287,6 +419,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="config", @@ -303,8 +436,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="audio", @@ -321,8 +455,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -333,8 +468,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=332, - serialized_end=490, + serialized_start=411, + serialized_end=569, ) @@ -344,6 +479,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="config", @@ -360,8 +496,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="audio", @@ -378,8 +515,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -390,8 +528,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=493, - serialized_end=662, + serialized_start=572, + serialized_end=741, ) @@ -401,6 +539,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="streaming_config", @@ -419,6 +558,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="audio_content", @@ -429,7 +569,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b(""), + default_value=b"", message_type=None, enum_type=None, containing_type=None, @@ -437,6 +577,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -452,11 +593,12 @@ full_name="google.cloud.speech.v1p1beta1.StreamingRecognizeRequest.streaming_request", index=0, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[], - ) + ), ], - serialized_start=665, - serialized_end=825, + serialized_start=744, + serialized_end=904, ) @@ -466,6 +608,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="config", @@ -482,8 +625,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="single_utterance", @@ -502,6 +646,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="interim_results", @@ -520,6 +665,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -530,8 +676,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=828, - serialized_end=978, + serialized_start=907, + serialized_end=1057, ) @@ -541,6 +687,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="encoding", @@ -559,6 +706,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="sample_rate_hertz", @@ -577,6 +725,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="audio_channel_count", @@ -595,6 +744,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="enable_separate_recognition_per_channel", @@ -613,6 +763,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="language_code", @@ -623,14 +774,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=b"\340A\002", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="alternative_language_codes", @@ -649,6 +801,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="max_alternatives", @@ -667,6 +820,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="profanity_filter", @@ -685,11 +839,31 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="adaptation", + full_name="google.cloud.speech.v1p1beta1.RecognitionConfig.adaptation", + index=8, + number=20, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="speech_contexts", full_name="google.cloud.speech.v1p1beta1.RecognitionConfig.speech_contexts", - index=8, + index=9, number=6, type=11, cpp_type=10, @@ -703,11 +877,12 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="enable_word_time_offsets", full_name="google.cloud.speech.v1p1beta1.RecognitionConfig.enable_word_time_offsets", - index=9, + index=10, number=8, type=8, cpp_type=7, @@ -721,11 +896,12 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="enable_word_confidence", full_name="google.cloud.speech.v1p1beta1.RecognitionConfig.enable_word_confidence", - index=10, + index=11, number=15, type=8, cpp_type=7, @@ -739,11 +915,12 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="enable_automatic_punctuation", full_name="google.cloud.speech.v1p1beta1.RecognitionConfig.enable_automatic_punctuation", - index=11, + index=12, number=11, type=8, cpp_type=7, @@ -757,11 +934,12 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="enable_speaker_diarization", full_name="google.cloud.speech.v1p1beta1.RecognitionConfig.enable_speaker_diarization", - index=12, + index=13, number=16, type=8, cpp_type=7, @@ -773,13 +951,14 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\030\001"), + serialized_options=b"\030\001", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="diarization_speaker_count", full_name="google.cloud.speech.v1p1beta1.RecognitionConfig.diarization_speaker_count", - index=13, + index=14, number=17, type=5, cpp_type=1, @@ -791,13 +970,14 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\030\001"), + serialized_options=b"\030\001", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="diarization_config", full_name="google.cloud.speech.v1p1beta1.RecognitionConfig.diarization_config", - index=14, + index=15, number=19, type=11, cpp_type=10, @@ -811,11 +991,12 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="metadata", full_name="google.cloud.speech.v1p1beta1.RecognitionConfig.metadata", - index=15, + index=16, number=9, type=11, cpp_type=10, @@ -829,17 +1010,18 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="model", full_name="google.cloud.speech.v1p1beta1.RecognitionConfig.model", - index=16, + index=17, number=13, type=9, cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -847,11 +1029,12 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="use_enhanced", full_name="google.cloud.speech.v1p1beta1.RecognitionConfig.use_enhanced", - index=17, + index=18, number=14, type=8, cpp_type=7, @@ -865,18 +1048,19 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], nested_types=[], - enum_types=[_RECOGNITIONCONFIG_AUDIOENCODING], + enum_types=[_RECOGNITIONCONFIG_AUDIOENCODING,], serialized_options=None, is_extendable=False, syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=981, - serialized_end=1900, + serialized_start=1060, + serialized_end=2048, ) @@ -886,6 +1070,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="enable_speaker_diarization", @@ -904,6 +1089,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="min_speaker_count", @@ -922,6 +1108,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="max_speaker_count", @@ -940,6 +1127,26 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="speaker_tag", + full_name="google.cloud.speech.v1p1beta1.SpeakerDiarizationConfig.speaker_tag", + index=3, + number=5, + type=5, + cpp_type=1, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=b"\030\001\340A\003", + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -950,8 +1157,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=1902, - serialized_end=2018, + serialized_start=2051, + serialized_end=2195, ) @@ -961,6 +1168,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="interaction_type", @@ -979,6 +1187,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="industry_naics_code_of_audio", @@ -997,6 +1206,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="microphone_distance", @@ -1015,6 +1225,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="original_media_type", @@ -1033,6 +1244,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="recording_device_type", @@ -1051,6 +1263,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="recording_device_name", @@ -1061,7 +1274,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1069,6 +1282,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="original_mime_type", @@ -1079,7 +1293,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1087,6 +1301,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="obfuscated_id", @@ -1103,8 +1318,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\030\001"), + serialized_options=b"\030\001", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="audio_topic", @@ -1115,7 +1331,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1123,6 +1339,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1138,8 +1355,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=2021, - serialized_end=3132, + serialized_start=2198, + serialized_end=3309, ) @@ -1149,6 +1366,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="phrases", @@ -1167,6 +1385,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="boost", @@ -1185,6 +1404,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1195,8 +1415,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3134, - serialized_end=3181, + serialized_start=3311, + serialized_end=3358, ) @@ -1206,6 +1426,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="content", @@ -1216,7 +1437,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b(""), + default_value=b"", message_type=None, enum_type=None, containing_type=None, @@ -1224,6 +1445,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="uri", @@ -1234,7 +1456,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1242,6 +1464,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1257,11 +1480,12 @@ full_name="google.cloud.speech.v1p1beta1.RecognitionAudio.audio_source", index=0, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[], - ) + ), ], - serialized_start=3183, - serialized_end=3251, + serialized_start=3360, + serialized_end=3428, ) @@ -1271,6 +1495,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="results", @@ -1289,7 +1514,8 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, - ) + create_key=_descriptor._internal_create_key, + ), ], extensions=[], nested_types=[], @@ -1299,8 +1525,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3253, - serialized_end=3345, + serialized_start=3430, + serialized_end=3522, ) @@ -1310,6 +1536,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="results", @@ -1328,7 +1555,8 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, - ) + create_key=_descriptor._internal_create_key, + ), ], extensions=[], nested_types=[], @@ -1338,8 +1566,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3347, - serialized_end=3450, + serialized_start=3524, + serialized_end=3627, ) @@ -1349,6 +1577,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="progress_percent", @@ -1367,6 +1596,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="start_time", @@ -1385,6 +1615,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="last_update_time", @@ -1403,6 +1634,26 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="uri", + full_name="google.cloud.speech.v1p1beta1.LongRunningRecognizeMetadata.uri", + index=3, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=b"\340A\003", + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1413,8 +1664,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3453, - serialized_end=3611, + serialized_start=3630, + serialized_end=3806, ) @@ -1424,6 +1675,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="error", @@ -1442,6 +1694,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="results", @@ -1460,6 +1713,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="speech_event_type", @@ -1478,18 +1732,19 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], nested_types=[], - enum_types=[_STREAMINGRECOGNIZERESPONSE_SPEECHEVENTTYPE], + enum_types=[_STREAMINGRECOGNIZERESPONSE_SPEECHEVENTTYPE,], serialized_options=None, is_extendable=False, syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3614, - serialized_end=3933, + serialized_start=3809, + serialized_end=4128, ) @@ -1499,6 +1754,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="alternatives", @@ -1517,6 +1773,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="is_final", @@ -1535,6 +1792,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="stability", @@ -1553,6 +1811,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="result_end_time", @@ -1571,6 +1830,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="channel_tag", @@ -1589,6 +1849,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="language_code", @@ -1599,14 +1860,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=b"\340A\003", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1617,8 +1879,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=3936, - serialized_end=4180, + serialized_start=4131, + serialized_end=4380, ) @@ -1628,6 +1890,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="alternatives", @@ -1646,6 +1909,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="channel_tag", @@ -1664,6 +1928,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="language_code", @@ -1674,14 +1939,15 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=b"\340A\003", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1692,8 +1958,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=4183, - serialized_end=4335, + serialized_start=4383, + serialized_end=4540, ) @@ -1703,6 +1969,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="transcript", @@ -1713,7 +1980,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1721,6 +1988,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="confidence", @@ -1739,6 +2007,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="words", @@ -1757,6 +2026,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1767,8 +2037,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=4337, - serialized_end=4463, + serialized_start=4542, + serialized_end=4668, ) @@ -1778,6 +2048,7 @@ filename=None, file=DESCRIPTOR, containing_type=None, + create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( name="start_time", @@ -1796,6 +2067,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="end_time", @@ -1814,6 +2086,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="word", @@ -1824,7 +2097,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -1832,6 +2105,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="confidence", @@ -1850,6 +2124,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), _descriptor.FieldDescriptor( name="speaker_tag", @@ -1866,8 +2141,9 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=None, + serialized_options=b"\340A\003", file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, ), ], extensions=[], @@ -1878,8 +2154,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=4466, - serialized_end=4623, + serialized_start=4671, + serialized_end=4833, ) _RECOGNIZEREQUEST.fields_by_name["config"].message_type = _RECOGNITIONCONFIG @@ -1905,6 +2181,11 @@ _RECOGNITIONCONFIG.fields_by_name[ "encoding" ].enum_type = _RECOGNITIONCONFIG_AUDIOENCODING +_RECOGNITIONCONFIG.fields_by_name[ + "adaptation" +].message_type = ( + google_dot_cloud_dot_speech__v1p1beta1_dot_proto_dot_resource__pb2._SPEECHADAPTATION +) _RECOGNITIONCONFIG.fields_by_name["speech_contexts"].message_type = _SPEECHCONTEXT _RECOGNITIONCONFIG.fields_by_name[ "diarization_config" @@ -2015,12 +2296,10 @@ RecognizeRequest = _reflection.GeneratedProtocolMessageType( "RecognizeRequest", (_message.Message,), - dict( - DESCRIPTOR=_RECOGNIZEREQUEST, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""The top-level message sent by the client for the - ``Recognize`` method. - + { + "DESCRIPTOR": _RECOGNIZEREQUEST, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """The top-level message sent by the client for the ``Recognize`` method. Attributes: config: @@ -2030,20 +2309,19 @@ Required. The audio data to be recognized. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.RecognizeRequest) - ), + }, ) _sym_db.RegisterMessage(RecognizeRequest) LongRunningRecognizeRequest = _reflection.GeneratedProtocolMessageType( "LongRunningRecognizeRequest", (_message.Message,), - dict( - DESCRIPTOR=_LONGRUNNINGRECOGNIZEREQUEST, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""The top-level message sent by the client for the + { + "DESCRIPTOR": _LONGRUNNINGRECOGNIZEREQUEST, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """The top-level message sent by the client for the ``LongRunningRecognize`` method. - Attributes: config: Required. Provides information to the recognizer that @@ -2052,23 +2330,22 @@ Required. The audio data to be recognized. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.LongRunningRecognizeRequest) - ), + }, ) _sym_db.RegisterMessage(LongRunningRecognizeRequest) StreamingRecognizeRequest = _reflection.GeneratedProtocolMessageType( "StreamingRecognizeRequest", (_message.Message,), - dict( - DESCRIPTOR=_STREAMINGRECOGNIZEREQUEST, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""The top-level message sent by the client for the + { + "DESCRIPTOR": _STREAMINGRECOGNIZEREQUEST, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """The top-level message sent by the client for the ``StreamingRecognize`` method. Multiple ``StreamingRecognizeRequest`` - messages are sent. The first message must contain a ``streaming_config`` - message and must not contain ``audio_content``. All subsequent messages - must contain ``audio_content`` and must not contain a - ``streaming_config`` message. - + messages are sent. The first message must contain a + ``streaming_config`` message and must not contain ``audio_content``. + All subsequent messages must contain ``audio_content`` and must not + contain a ``streaming_config`` message. Attributes: streaming_request: @@ -2091,19 +2368,18 @@ to-text/quotas#content>`__. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.StreamingRecognizeRequest) - ), + }, ) _sym_db.RegisterMessage(StreamingRecognizeRequest) StreamingRecognitionConfig = _reflection.GeneratedProtocolMessageType( "StreamingRecognitionConfig", (_message.Message,), - dict( - DESCRIPTOR=_STREAMINGRECOGNITIONCONFIG, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""Provides information to the recognizer that specifies how - to process the request. - + { + "DESCRIPTOR": _STREAMINGRECOGNITIONCONFIG, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """Provides information to the recognizer that specifies how to process + the request. Attributes: config: @@ -2129,19 +2405,18 @@ omitted, only ``is_final=true`` result(s) are returned. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.StreamingRecognitionConfig) - ), + }, ) _sym_db.RegisterMessage(StreamingRecognitionConfig) RecognitionConfig = _reflection.GeneratedProtocolMessageType( "RecognitionConfig", (_message.Message,), - dict( - DESCRIPTOR=_RECOGNITIONCONFIG, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""Provides information to the recognizer that specifies how - to process the request. - + { + "DESCRIPTOR": _RECOGNITIONCONFIG, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """Provides information to the recognizer that specifies how to process + the request. Attributes: encoding: @@ -2154,7 +2429,7 @@ Sample rate in Hertz of the audio data sent in all ``RecognitionAudio`` messages. Valid values are: 8000-48000. 16000 is optimal. For best results, set the sampling rate of - the audio source to 16000 Hz. If that's not possible, use the + the audio source to 16000 Hz. If that’s not possible, use the native sample rate of the audio source (instead of re- sampling). This field is optional for FLAC and WAV audio files, but is required for all other audio formats. For @@ -2163,13 +2438,12 @@ audio_channel_count: The number of channels in the input audio data. ONLY set this for MULTI-CHANNEL recognition. Valid values for LINEAR16 and - FLAC are ``1``-``8``. Valid values for OGG\_OPUS are - '1'-'254'. Valid value for MULAW, AMR, AMR\_WB and - SPEEX\_WITH\_HEADER\_BYTE is only ``1``. If ``0`` or omitted, - defaults to one channel (mono). Note: We only recognize the - first channel by default. To perform independent recognition - on each channel set - ``enable_separate_recognition_per_channel`` to 'true'. + FLAC are ``1``-``8``. Valid values for OGG_OPUS are ‘1’-‘254’. + Valid value for MULAW, AMR, AMR_WB and SPEEX_WITH_HEADER_BYTE + is only ``1``. If ``0`` or omitted, defaults to one channel + (mono). Note: We only recognize the first channel by default. + To perform independent recognition on each channel set + ``enable_separate_recognition_per_channel`` to ‘true’. enable_separate_recognition_per_channel: This needs to be set to ``true`` explicitly and ``audio_channel_count`` > 1 to get each channel recognized @@ -2182,7 +2456,7 @@ language_code: Required. The language of the supplied audio as a `BCP-47 `__ language - tag. Example: "en-US". See `Language Support + tag. Example: “en-US”. See `Language Support `__ for a list of the currently supported language codes. alternative_language_codes: @@ -2193,7 +2467,7 @@ text/docs/languages>`__ for a list of the currently supported language codes. If alternative languages are listed, recognition result will contain recognition in the most likely - language detected including the main language\_code. The + language detected including the main language_code. The recognition result will include the language tag of the language detected in the audio. Note: This feature is only supported for Voice Command and Voice Search use cases and @@ -2210,8 +2484,15 @@ profanity_filter: If set to ``true``, the server will attempt to filter out profanities, replacing all but the initial character in each - filtered word with asterisks, e.g. "f\*\*\*". If set to - ``false`` or omitted, profanities won't be filtered out. + filtered word with asterisks, e.g. "f***". If set to ``false`` + or omitted, profanities won’t be filtered out. + adaptation: + Speech adaptation configuration improves the accuracy of + speech recognition. When speech adaptation is set it + supersedes the ``speech_contexts`` field. For more + information, see the `speech adaptation + `__ documentation. speech_contexts: Array of [SpeechContext][google.cloud.speech.v1p1beta1.SpeechContext]. @@ -2229,23 +2510,21 @@ confidence for those words. If ``false``, no word-level confidence information is returned. The default is ``false``. enable_automatic_punctuation: - If 'true', adds punctuation to recognition result hypotheses. + If ‘true’, adds punctuation to recognition result hypotheses. This feature is only available in select languages. Setting this for requests in other languages has no effect at all. The - default 'false' value does not add punctuation to result - hypotheses. Note: This is currently offered as an experimental - service, complimentary to all users. In the future this may be - exclusively available as a premium feature. + default ‘false’ value does not add punctuation to result + hypotheses. enable_speaker_diarization: - If 'true', enables speaker detection for each recognized word + If ‘true’, enables speaker detection for each recognized word in the top alternative of the recognition result using a - speaker\_tag provided in the WordInfo. Note: Use - diarization\_config instead. + speaker_tag provided in the WordInfo. Note: Use + diarization_config instead. diarization_speaker_count: If set, specifies the estimated number of speakers in the - conversation. Defaults to '2'. Ignored unless - enable\_speaker\_diarization is set to true. Note: Use - diarization\_config instead. + conversation. Defaults to ‘2’. Ignored unless + enable_speaker_diarization is set to true. Note: Use + diarization_config instead. diarization_config: Config to enable speaker diarization and set additional parameters to make diarization better suited for your @@ -2263,26 +2542,29 @@ best suited to your domain to get best results. If a model is not explicitly specified, then we auto-select a model based on the parameters in the RecognitionConfig. .. raw:: html - .. raw:: html :: - .. raw:: html .. raw:: - html :: - .. - raw:: html .. raw:: html :: - .. raw:: html .. raw:: - html :: - .. - raw:: html .. raw:: html :: - .. raw:: - html .. raw:: html
ModelDescription
command_and_search Best for - short queries such as voice commands or voice search.
phone_call Best for audio that - originated from a phone call (typically recorded at an - 8khz sampling rate).
videoBest for audio that originated from from video or includes - multiple speakers. Ideally the audio is recorded at a - 16khz or greater sampling rate. This is a premium - model that costs more than the standard rate.
default Best for audio that is - not one of the specific audio models. For example, - long-form audio. Ideally the audio is high-fidelity, - recorded at a 16khz or greater sampling rate.
+ .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. raw:: + html .. raw:: html .. raw:: html .. raw:: html .. raw:: html .. + raw:: html .. + raw:: html .. raw:: html .. raw:: html + .. raw:: html + .. raw:: html .. raw:: html .. raw:: html + .. raw:: html + .. raw:: html .. raw:: html + .. raw:: html
Model + .. raw:: html Description + .. raw:: html
command_and_search .. + raw:: html Best for short + queries such as voice commands or voice search. .. raw:: html +
phone_call .. raw:: html Best for audio that originated from a + phone call (typically recorded at an 8khz sampling rate). .. + raw:: html
video .. raw:: html Best for audio that originated from + from video or includes multiple speakers. Ideally the audio is + recorded at a 16khz or greater sampling rate. This is a + premium model that costs more than the standard rate. .. + raw:: html
default .. raw:: html Best for audio that is not one of the + specific audio models. For example, long-form audio. Ideally + the audio is high-fidelity, recorded at a 16khz or greater + sampling rate. .. raw:: html
use_enhanced: Set to true to use an enhanced model for speech recognition. If ``use_enhanced`` is set to true and the ``model`` field is @@ -2293,24 +2575,23 @@ version of the specified model. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.RecognitionConfig) - ), + }, ) _sym_db.RegisterMessage(RecognitionConfig) SpeakerDiarizationConfig = _reflection.GeneratedProtocolMessageType( "SpeakerDiarizationConfig", (_message.Message,), - dict( - DESCRIPTOR=_SPEAKERDIARIZATIONCONFIG, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""Config to enable speaker diarization. - + { + "DESCRIPTOR": _SPEAKERDIARIZATIONCONFIG, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """Config to enable speaker diarization. Attributes: enable_speaker_diarization: - If 'true', enables speaker detection for each recognized word + If ‘true’, enables speaker detection for each recognized word in the top alternative of the recognition result using a - speaker\_tag provided in the WordInfo. + speaker_tag provided in the WordInfo. min_speaker_count: Minimum number of speakers in the conversation. This range gives you more flexibility by allowing the system to @@ -2321,20 +2602,21 @@ gives you more flexibility by allowing the system to automatically determine the correct number of speakers. If not set, the default value is 6. + speaker_tag: + Output only. Unused. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.SpeakerDiarizationConfig) - ), + }, ) _sym_db.RegisterMessage(SpeakerDiarizationConfig) RecognitionMetadata = _reflection.GeneratedProtocolMessageType( "RecognitionMetadata", (_message.Message,), - dict( - DESCRIPTOR=_RECOGNITIONMETADATA, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""Description of audio data to be recognized. - + { + "DESCRIPTOR": _RECOGNITIONMETADATA, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """Description of audio data to be recognized. Attributes: interaction_type: @@ -2353,9 +2635,9 @@ recording_device_type: The type of device the speech was recorded with. recording_device_name: - The device used to make the recording. Examples 'Nexus 5X' or - 'Polycom SoundStation IP 6000' or 'POTS' or 'VoIP' or - 'Cardioid Microphone'. + The device used to make the recording. Examples ‘Nexus 5X’ or + ‘Polycom SoundStation IP 6000’ or ‘POTS’ or ‘VoIP’ or + ‘Cardioid Microphone’. original_mime_type: Mime type of the original audio file. For example ``audio/m4a``, ``audio/x-alaw-basic``, ``audio/mp3``, @@ -2366,27 +2648,26 @@ Obfuscated (privacy-protected) ID of the user, to identify number of unique users using the service. audio_topic: - Description of the content. Eg. "Recordings of federal supreme - court hearings from 2012". + Description of the content. Eg. “Recordings of federal supreme + court hearings from 2012”. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.RecognitionMetadata) - ), + }, ) _sym_db.RegisterMessage(RecognitionMetadata) SpeechContext = _reflection.GeneratedProtocolMessageType( "SpeechContext", (_message.Message,), - dict( - DESCRIPTOR=_SPEECHCONTEXT, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""Provides "hints" to the speech recognizer to favor - specific words and phrases in the results. - + { + "DESCRIPTOR": _SPEECHCONTEXT, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """Provides “hints” to the speech recognizer to favor specific words and + phrases in the results. Attributes: phrases: - A list of strings containing words and phrases "hints" so that + A list of strings containing words and phrases “hints” so that the speech recognition is more likely to recognize them. This can be used to improve the accuracy for specific words and phrases, for example, if specific commands are typically @@ -2411,23 +2692,22 @@ use case. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.SpeechContext) - ), + }, ) _sym_db.RegisterMessage(SpeechContext) RecognitionAudio = _reflection.GeneratedProtocolMessageType( "RecognitionAudio", (_message.Message,), - dict( - DESCRIPTOR=_RECOGNITIONAUDIO, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""Contains audio data in the encoding specified in the + { + "DESCRIPTOR": _RECOGNITIONAUDIO, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """Contains audio data in the encoding specified in the ``RecognitionConfig``. Either ``content`` or ``uri`` must be supplied. Supplying both or neither returns - [google.rpc.Code.INVALID\_ARGUMENT][google.rpc.Code.INVALID\_ARGUMENT]. - See `content - limits `__. - + [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. + See `content limits `__. Attributes: audio_source: @@ -2444,73 +2724,70 @@ compressed (for example, gzip). Currently, only Google Cloud Storage URIs are supported, which must be specified in the following format: ``gs://bucket_name/object_name`` (other URI - formats return [google.rpc.Code.INVALID\_ARGUMENT][google.rpc. - Code.INVALID\_ARGUMENT]). For more information, see `Request + formats return [google.rpc.Code.INVALID_ARGUMENT][google.rpc.C + ode.INVALID_ARGUMENT]). For more information, see `Request URIs `__. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.RecognitionAudio) - ), + }, ) _sym_db.RegisterMessage(RecognitionAudio) RecognizeResponse = _reflection.GeneratedProtocolMessageType( "RecognizeResponse", (_message.Message,), - dict( - DESCRIPTOR=_RECOGNIZERESPONSE, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""The only message returned to the client by the - ``Recognize`` method. It contains the result as zero or more sequential + { + "DESCRIPTOR": _RECOGNIZERESPONSE, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """The only message returned to the client by the ``Recognize`` method. + It contains the result as zero or more sequential ``SpeechRecognitionResult`` messages. - Attributes: results: Sequential list of transcription results corresponding to sequential portions of audio. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.RecognizeResponse) - ), + }, ) _sym_db.RegisterMessage(RecognizeResponse) LongRunningRecognizeResponse = _reflection.GeneratedProtocolMessageType( "LongRunningRecognizeResponse", (_message.Message,), - dict( - DESCRIPTOR=_LONGRUNNINGRECOGNIZERESPONSE, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""The only message returned to the client by the - ``LongRunningRecognize`` method. It contains the result as zero or more - sequential ``SpeechRecognitionResult`` messages. It is included in the - ``result.response`` field of the ``Operation`` returned by the + { + "DESCRIPTOR": _LONGRUNNINGRECOGNIZERESPONSE, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """The only message returned to the client by the + ``LongRunningRecognize`` method. It contains the result as zero or + more sequential ``SpeechRecognitionResult`` messages. It is included + in the ``result.response`` field of the ``Operation`` returned by the ``GetOperation`` call of the ``google::longrunning::Operations`` service. - Attributes: results: Sequential list of transcription results corresponding to sequential portions of audio. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.LongRunningRecognizeResponse) - ), + }, ) _sym_db.RegisterMessage(LongRunningRecognizeResponse) LongRunningRecognizeMetadata = _reflection.GeneratedProtocolMessageType( "LongRunningRecognizeMetadata", (_message.Message,), - dict( - DESCRIPTOR=_LONGRUNNINGRECOGNIZEMETADATA, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""Describes the progress of a long-running - ``LongRunningRecognize`` call. It is included in the ``metadata`` field - of the ``Operation`` returned by the ``GetOperation`` call of the + { + "DESCRIPTOR": _LONGRUNNINGRECOGNIZEMETADATA, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """Describes the progress of a long-running ``LongRunningRecognize`` + call. It is included in the ``metadata`` field of the ``Operation`` + returned by the ``GetOperation`` call of the ``google::longrunning::Operations`` service. - Attributes: progress_percent: Approximate percentage of audio processed thus far. Guaranteed @@ -2520,68 +2797,52 @@ Time when the request was received. last_update_time: Time of the most recent processing update. + uri: + The URI of the audio file being transcribed. Empty if the + audio was sent as byte content. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.LongRunningRecognizeMetadata) - ), + }, ) _sym_db.RegisterMessage(LongRunningRecognizeMetadata) StreamingRecognizeResponse = _reflection.GeneratedProtocolMessageType( "StreamingRecognizeResponse", (_message.Message,), - dict( - DESCRIPTOR=_STREAMINGRECOGNIZERESPONSE, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""\ ``StreamingRecognizeResponse`` is the only message - returned to the client by ``StreamingRecognize``. A series of zero or - more ``StreamingRecognizeResponse`` messages are streamed back to the + { + "DESCRIPTOR": _STREAMINGRECOGNIZERESPONSE, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """\ ``StreamingRecognizeResponse`` is the only message returned to the + client by ``StreamingRecognize``. A series of zero or more + ``StreamingRecognizeResponse`` messages are streamed back to the client. If there is no recognizable audio, and ``single_utterance`` is set to false, then no messages are streamed back to the client. - - Here's an example of a series of ten ``StreamingRecognizeResponse``\ s - that might be returned while processing audio: - - 1. results { alternatives { transcript: "tube" } stability: 0.01 } - - 2. results { alternatives { transcript: "to be a" } stability: 0.01 } - - 3. results { alternatives { transcript: "to be" } stability: 0.9 } - results { alternatives { transcript: " or not to be" } stability: - 0.01 } - - 4. results { alternatives { transcript: "to be or not to be" confidence: - 0.92 } alternatives { transcript: "to bee or not to bee" } is\_final: - true } - - 5. results { alternatives { transcript: " that's" } stability: 0.01 } - - 6. results { alternatives { transcript: " that is" } stability: 0.9 } - results { alternatives { transcript: " the question" } stability: - 0.01 } - - 7. results { alternatives { transcript: " that is the question" - confidence: 0.98 } alternatives { transcript: " that was the - question" } is\_final: true } - - Notes: - - - Only two of the above responses #4 and #7 contain final results; they - are indicated by ``is_final: true``. Concatenating these together - generates the full transcript: "to be or not to be that is the - question". - - - The others contain interim ``results``. #3 and #6 contain two interim - ``results``: the first portion has a high stability and is less - likely to change; the second portion has a low stability and is very - likely to change. A UI designer might choose to show only high - stability ``results``. - - - The specific ``stability`` and ``confidence`` values shown above are - only for illustrative purposes. Actual values may vary. - - - In each response, only one of these fields will be set: ``error``, - ``speech_event_type``, or one or more (repeated) ``results``. - + Here’s an example of a series of ten ``StreamingRecognizeResponse``\ s + that might be returned while processing audio: 1. results { + alternatives { transcript: “tube” } stability: 0.01 } 2. results { + alternatives { transcript: “to be a” } stability: 0.01 } 3. results { + alternatives { transcript: “to be” } stability: 0.9 } results { + alternatives { transcript: " or not to be" } stability: 0.01 } 4. + results { alternatives { transcript: “to be or not to be” confidence: + 0.92 } alternatives { transcript: “to bee or not to bee” } is_final: + true } 5. results { alternatives { transcript: " that’s" } stability: + 0.01 } 6. results { alternatives { transcript: " that is" } + stability: 0.9 } results { alternatives { transcript: " the + question" } stability: 0.01 } 7. results { alternatives { + transcript: " that is the question" confidence: 0.98 } alternatives + { transcript: " that was the question" } is_final: true } Notes: + - Only two of the above responses #4 and #7 contain final results; + they are indicated by ``is_final: true``. Concatenating these + together generates the full transcript: “to be or not to be that is + the question”. - The others contain interim ``results``. #3 and + #6 contain two interim ``results``: the first portion has a high + stability and is less likely to change; the second portion has a + low stability and is very likely to change. A UI designer might + choose to show only high stability ``results``. - The specific + ``stability`` and ``confidence`` values shown above are only for + illustrative purposes. Actual values may vary. - In each response, + only one of these fields will be set: ``error``, + ``speech_event_type``, or one or more (repeated) ``results``. Attributes: error: @@ -2597,19 +2858,18 @@ Indicates the type of speech event. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.StreamingRecognizeResponse) - ), + }, ) _sym_db.RegisterMessage(StreamingRecognizeResponse) StreamingRecognitionResult = _reflection.GeneratedProtocolMessageType( "StreamingRecognitionResult", (_message.Message,), - dict( - DESCRIPTOR=_STREAMINGRECOGNITIONRESULT, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""A streaming speech recognition result corresponding to a - portion of the audio that is currently being processed. - + { + "DESCRIPTOR": _STREAMINGRECOGNITIONRESULT, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """A streaming speech recognition result corresponding to a portion of + the audio that is currently being processed. Attributes: alternatives: @@ -2638,27 +2898,26 @@ channel_tag: For multi-channel audio, this is the channel number corresponding to the recognized result for the audio from that - channel. For audio\_channel\_count = N, its output values can - range from '1' to 'N'. + channel. For audio_channel_count = N, its output values can + range from ‘1’ to ‘N’. language_code: - The `BCP-47 `__ - language tag of the language in this result. This language - code was detected to have the most likelihood of being spoken - in the audio. + Output only. The `BCP-47 `__ language tag of the language + in this result. This language code was detected to have the + most likelihood of being spoken in the audio. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.StreamingRecognitionResult) - ), + }, ) _sym_db.RegisterMessage(StreamingRecognitionResult) SpeechRecognitionResult = _reflection.GeneratedProtocolMessageType( "SpeechRecognitionResult", (_message.Message,), - dict( - DESCRIPTOR=_SPEECHRECOGNITIONRESULT, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""A speech recognition result corresponding to a portion of the audio. - + { + "DESCRIPTOR": _SPEECHRECOGNITIONRESULT, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """A speech recognition result corresponding to a portion of the audio. Attributes: alternatives: @@ -2670,27 +2929,26 @@ channel_tag: For multi-channel audio, this is the channel number corresponding to the recognized result for the audio from that - channel. For audio\_channel\_count = N, its output values can - range from '1' to 'N'. + channel. For audio_channel_count = N, its output values can + range from ‘1’ to ‘N’. language_code: - The `BCP-47 `__ - language tag of the language in this result. This language - code was detected to have the most likelihood of being spoken - in the audio. + Output only. The `BCP-47 `__ language tag of the language + in this result. This language code was detected to have the + most likelihood of being spoken in the audio. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.SpeechRecognitionResult) - ), + }, ) _sym_db.RegisterMessage(SpeechRecognitionResult) SpeechRecognitionAlternative = _reflection.GeneratedProtocolMessageType( "SpeechRecognitionAlternative", (_message.Message,), - dict( - DESCRIPTOR=_SPEECHRECOGNITIONALTERNATIVE, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""Alternative hypotheses (a.k.a. n-best list). - + { + "DESCRIPTOR": _SPEECHRECOGNITIONALTERNATIVE, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """Alternative hypotheses (a.k.a. n-best list). Attributes: transcript: @@ -2710,18 +2968,17 @@ see all the words from the beginning of the audio. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.SpeechRecognitionAlternative) - ), + }, ) _sym_db.RegisterMessage(SpeechRecognitionAlternative) WordInfo = _reflection.GeneratedProtocolMessageType( "WordInfo", (_message.Message,), - dict( - DESCRIPTOR=_WORDINFO, - __module__="google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", - __doc__="""Word-specific information for recognized words. - + { + "DESCRIPTOR": _WORDINFO, + "__module__": "google.cloud.speech_v1p1beta1.proto.cloud_speech_pb2", + "__doc__": """Word-specific information for recognized words. Attributes: start_time: @@ -2748,15 +3005,15 @@ provided. The default of 0.0 is a sentinel value indicating ``confidence`` was not set. speaker_tag: - A distinct integer value is assigned for every speaker within - the audio. This field specifies which one of those speakers - was detected to have spoken this word. Value ranges from '1' - to diarization\_speaker\_count. speaker\_tag is set if - enable\_speaker\_diarization = 'true' and only in the top + Output only. A distinct integer value is assigned for every + speaker within the audio. This field specifies which one of + those speakers was detected to have spoken this word. Value + ranges from ‘1’ to diarization_speaker_count. speaker_tag is + set if enable_speaker_diarization = ‘true’ and only in the top alternative. """, # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.WordInfo) - ), + }, ) _sym_db.RegisterMessage(WordInfo) @@ -2770,18 +3027,22 @@ _RECOGNITIONCONFIG.fields_by_name["language_code"]._options = None _RECOGNITIONCONFIG.fields_by_name["enable_speaker_diarization"]._options = None _RECOGNITIONCONFIG.fields_by_name["diarization_speaker_count"]._options = None +_SPEAKERDIARIZATIONCONFIG.fields_by_name["speaker_tag"]._options = None _RECOGNITIONMETADATA.fields_by_name["obfuscated_id"]._options = None +_LONGRUNNINGRECOGNIZEMETADATA.fields_by_name["uri"]._options = None +_STREAMINGRECOGNITIONRESULT.fields_by_name["language_code"]._options = None +_SPEECHRECOGNITIONRESULT.fields_by_name["language_code"]._options = None +_WORDINFO.fields_by_name["speaker_tag"]._options = None _SPEECH = _descriptor.ServiceDescriptor( name="Speech", full_name="google.cloud.speech.v1p1beta1.Speech", file=DESCRIPTOR, index=0, - serialized_options=_b( - "\312A\025speech.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform" - ), - serialized_start=4626, - serialized_end=5268, + serialized_options=b"\312A\025speech.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform", + create_key=_descriptor._internal_create_key, + serialized_start=4836, + serialized_end=5478, methods=[ _descriptor.MethodDescriptor( name="Recognize", @@ -2790,9 +3051,8 @@ containing_service=None, input_type=_RECOGNIZEREQUEST, output_type=_RECOGNIZERESPONSE, - serialized_options=_b( - '\202\323\344\223\002 "\033/v1p1beta1/speech:recognize:\001*\332A\014config,audio' - ), + serialized_options=b'\202\323\344\223\002 "\033/v1p1beta1/speech:recognize:\001*\332A\014config,audio', + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="LongRunningRecognize", @@ -2801,9 +3061,8 @@ containing_service=None, input_type=_LONGRUNNINGRECOGNIZEREQUEST, output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=_b( - '\202\323\344\223\002+"&/v1p1beta1/speech:longrunningrecognize:\001*\332A\014config,audio\312A<\n\034LongRunningRecognizeResponse\022\034LongRunningRecognizeMetadata' - ), + serialized_options=b'\202\323\344\223\002+"&/v1p1beta1/speech:longrunningrecognize:\001*\332A\014config,audio\312A<\n\034LongRunningRecognizeResponse\022\034LongRunningRecognizeMetadata', + create_key=_descriptor._internal_create_key, ), _descriptor.MethodDescriptor( name="StreamingRecognize", @@ -2813,6 +3072,7 @@ input_type=_STREAMINGRECOGNIZEREQUEST, output_type=_STREAMINGRECOGNIZERESPONSE, serialized_options=None, + create_key=_descriptor._internal_create_key, ), ], ) diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/cloud_speech_pb2_grpc.py b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/cloud_speech_pb2_grpc.py index ba4950fd256e..a5e3f268c906 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/cloud_speech_pb2_grpc.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/cloud_speech_pb2_grpc.py @@ -1,4 +1,5 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" import grpc from google.cloud.speech_v1p1beta1.proto import ( @@ -11,14 +12,14 @@ class SpeechStub(object): """Service that implements Google Cloud Speech API. - """ + """ def __init__(self, channel): """Constructor. - Args: - channel: A grpc.Channel. - """ + Args: + channel: A grpc.Channel. + """ self.Recognize = channel.unary_unary( "/google.cloud.speech.v1p1beta1.Speech/Recognize", request_serializer=google_dot_cloud_dot_speech__v1p1beta1_dot_proto_dot_cloud__speech__pb2.RecognizeRequest.SerializeToString, @@ -38,32 +39,32 @@ def __init__(self, channel): class SpeechServicer(object): """Service that implements Google Cloud Speech API. - """ + """ def Recognize(self, request, context): """Performs synchronous speech recognition: receive results after all audio - has been sent and processed. - """ + has been sent and processed. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def LongRunningRecognize(self, request, context): """Performs asynchronous speech recognition: receive results via the - google.longrunning.Operations interface. Returns either an - `Operation.error` or an `Operation.response` which contains - a `LongRunningRecognizeResponse` message. - For more information on asynchronous speech recognition, see the - [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize). - """ + google.longrunning.Operations interface. Returns either an + `Operation.error` or an `Operation.response` which contains + a `LongRunningRecognizeResponse` message. + For more information on asynchronous speech recognition, see the + [how-to](https://cloud.google.com/speech-to-text/docs/async-recognize). + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def StreamingRecognize(self, request_iterator, context): """Performs bidirectional streaming speech recognition: receive results while - sending audio. This method is only available via the gRPC API (not REST). - """ + sending audio. This method is only available via the gRPC API (not REST). + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") @@ -91,3 +92,90 @@ def add_SpeechServicer_to_server(servicer, server): "google.cloud.speech.v1p1beta1.Speech", rpc_method_handlers ) server.add_generic_rpc_handlers((generic_handler,)) + + +# This class is part of an EXPERIMENTAL API. +class Speech(object): + """Service that implements Google Cloud Speech API. + """ + + @staticmethod + def Recognize( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.speech.v1p1beta1.Speech/Recognize", + google_dot_cloud_dot_speech__v1p1beta1_dot_proto_dot_cloud__speech__pb2.RecognizeRequest.SerializeToString, + google_dot_cloud_dot_speech__v1p1beta1_dot_proto_dot_cloud__speech__pb2.RecognizeResponse.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def LongRunningRecognize( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.speech.v1p1beta1.Speech/LongRunningRecognize", + google_dot_cloud_dot_speech__v1p1beta1_dot_proto_dot_cloud__speech__pb2.LongRunningRecognizeRequest.SerializeToString, + google_dot_longrunning_dot_operations__pb2.Operation.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def StreamingRecognize( + request_iterator, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.stream_stream( + request_iterator, + target, + "/google.cloud.speech.v1p1beta1.Speech/StreamingRecognize", + google_dot_cloud_dot_speech__v1p1beta1_dot_proto_dot_cloud__speech__pb2.StreamingRecognizeRequest.SerializeToString, + google_dot_cloud_dot_speech__v1p1beta1_dot_proto_dot_cloud__speech__pb2.StreamingRecognizeResponse.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/resource.proto b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/resource.proto new file mode 100644 index 000000000000..5bb379ff1504 --- /dev/null +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/resource.proto @@ -0,0 +1,129 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.speech.v1p1beta1; + +import "google/api/annotations.proto"; +import "google/api/resource.proto"; + +option cc_enable_arenas = true; +option go_package = "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1;speech"; +option java_multiple_files = true; +option java_outer_classname = "SpeechResourceProto"; +option java_package = "com.google.cloud.speech.v1p1beta1"; +option objc_class_prefix = "GCS"; + +// A set of words or phrases that represents a common concept likely to appear +// in your audio, for example a list of passenger ship names. CustomClass items +// can be substituted into placeholders that you set in PhraseSet phrases. +message CustomClass { + option (google.api.resource) = { + type: "speech.googleapis.com/CustomClass" + pattern: "projects/{project}/locations/{location}/customClasses/{custom_class}" + }; + + // An item of the class. + message ClassItem { + // The class item's value. + string value = 1; + } + + // The resource name of the custom class. + string name = 1; + + // If this custom class is a resource, the custom_class_id is the resource id + // of the CustomClass. + string custom_class_id = 2; + + // A collection of class items. + repeated ClassItem items = 3; +} + +// Provides "hints" to the speech recognizer to favor specific words and phrases +// in the results. +message PhraseSet { + option (google.api.resource) = { + type: "speech.googleapis.com/PhraseSet" + pattern: "projects/{project}/locations/{location}/phraseSets/{phrase_set}" + }; + + // A phrases containing words and phrase "hints" so that + // the speech recognition is more likely to recognize them. This can be used + // to improve the accuracy for specific words and phrases, for example, if + // specific commands are typically spoken by the user. This can also be used + // to add additional words to the vocabulary of the recognizer. See + // [usage limits](https://cloud.google.com/speech-to-text/quotas#content). + // + // List items can also include pre-built or custom classes containing groups + // of words that represent common concepts that occur in natural language. For + // example, rather than providing a phrase hint for every month of the + // year (e.g. "i was born in january", "i was born in febuary", ...), use the + // pre-built `$MONTH` class improves the likelihood of correctly transcribing + // audio that includes months (e.g. "i was born in $month"). + // To refer to pre-built classes, use the class' symbol prepended with `$` + // e.g. `$MONTH`. To refer to custom classes that were defined inline in the + // request, set the class's `custom_class_id` to a string unique to all class + // resources and inline classes. Then use the class' id wrapped in $`{...}` + // e.g. "${my-months}". To refer to custom classes resources, use the class' + // id wrapped in `${}` (e.g. `${my-months}`). + message Phrase { + // The phrase itself. + string value = 1; + + // Hint Boost. Overrides the boost set at the phrase set level. + // Positive value will increase the probability that a specific phrase will + // be recognized over other similar sounding phrases. The higher the boost, + // the higher the chance of false positive recognition as well. Negative + // boost values would correspond to anti-biasing. Anti-biasing is not + // enabled, so negative boost will simply be ignored. Though `boost` can + // accept a wide range of positive values, most use cases are best served + // with values between 0 and 20. We recommend using a binary search approach + // to finding the optimal value for your use case. Speech recognition + // will skip PhraseSets with a boost value of 0. + float boost = 2; + } + + // The resource name of the phrase set. + string name = 1; + + // A list of word and phrases. + repeated Phrase phrases = 2; + + // Hint Boost. Positive value will increase the probability that a specific + // phrase will be recognized over other similar sounding phrases. The higher + // the boost, the higher the chance of false positive recognition as well. + // Negative boost values would correspond to anti-biasing. Anti-biasing is not + // enabled, so negative boost will simply be ignored. Though `boost` can + // accept a wide range of positive values, most use cases are best served with + // values between 0 (exclusive) and 20. We recommend using a binary search + // approach to finding the optimal value for your use case. Speech recognition + // will skip PhraseSets with a boost value of 0. + float boost = 4; +} + +// Speech adaptation configuration. +message SpeechAdaptation { + // A collection of phrase sets. To specify the hints inline, leave the + // phrase set's `name` blank and fill in the rest of its fields. Any + // phrase set can use any custom class. + repeated PhraseSet phrase_sets = 1; + + // A collection of custom classes. To specify the classes inline, leave the + // class' `name` blank and fill in the rest of its fields, giving it a unique + // `custom_class_id`. Refer to the inline defined class in phrase hints by its + // `custom_class_id`. + repeated CustomClass custom_classes = 2; +} diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/resource_pb2.py b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/resource_pb2.py new file mode 100644 index 000000000000..68e825886584 --- /dev/null +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/resource_pb2.py @@ -0,0 +1,509 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/speech_v1p1beta1/proto/resource.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="google/cloud/speech_v1p1beta1/proto/resource.proto", + package="google.cloud.speech.v1p1beta1", + syntax="proto3", + serialized_options=b"\n!com.google.cloud.speech.v1p1beta1B\023SpeechResourceProtoP\001ZCgoogle.golang.org/genproto/googleapis/cloud/speech/v1p1beta1;speech\370\001\001\242\002\003GCS", + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n2google/cloud/speech_v1p1beta1/proto/resource.proto\x12\x1dgoogle.cloud.speech.v1p1beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x19google/api/resource.proto"\x83\x02\n\x0b\x43ustomClass\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x17\n\x0f\x63ustom_class_id\x18\x02 \x01(\t\x12\x43\n\x05items\x18\x03 \x03(\x0b\x32\x34.google.cloud.speech.v1p1beta1.CustomClass.ClassItem\x1a\x1a\n\tClassItem\x12\r\n\x05value\x18\x01 \x01(\t:l\xea\x41i\n!speech.googleapis.com/CustomClass\x12\x44projects/{project}/locations/{location}/customClasses/{custom_class}"\xf9\x01\n\tPhraseSet\x12\x0c\n\x04name\x18\x01 \x01(\t\x12@\n\x07phrases\x18\x02 \x03(\x0b\x32/.google.cloud.speech.v1p1beta1.PhraseSet.Phrase\x12\r\n\x05\x62oost\x18\x04 \x01(\x02\x1a&\n\x06Phrase\x12\r\n\x05value\x18\x01 \x01(\t\x12\r\n\x05\x62oost\x18\x02 \x01(\x02:e\xea\x41\x62\n\x1fspeech.googleapis.com/PhraseSet\x12?projects/{project}/locations/{location}/phraseSets/{phrase_set}"\x95\x01\n\x10SpeechAdaptation\x12=\n\x0bphrase_sets\x18\x01 \x03(\x0b\x32(.google.cloud.speech.v1p1beta1.PhraseSet\x12\x42\n\x0e\x63ustom_classes\x18\x02 \x03(\x0b\x32*.google.cloud.speech.v1p1beta1.CustomClassB\x88\x01\n!com.google.cloud.speech.v1p1beta1B\x13SpeechResourceProtoP\x01ZCgoogle.golang.org/genproto/googleapis/cloud/speech/v1p1beta1;speech\xf8\x01\x01\xa2\x02\x03GCSb\x06proto3', + dependencies=[ + google_dot_api_dot_annotations__pb2.DESCRIPTOR, + google_dot_api_dot_resource__pb2.DESCRIPTOR, + ], +) + + +_CUSTOMCLASS_CLASSITEM = _descriptor.Descriptor( + name="ClassItem", + full_name="google.cloud.speech.v1p1beta1.CustomClass.ClassItem", + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name="value", + full_name="google.cloud.speech.v1p1beta1.CustomClass.ClassItem.value", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=266, + serialized_end=292, +) + +_CUSTOMCLASS = _descriptor.Descriptor( + name="CustomClass", + full_name="google.cloud.speech.v1p1beta1.CustomClass", + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.speech.v1p1beta1.CustomClass.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="custom_class_id", + full_name="google.cloud.speech.v1p1beta1.CustomClass.custom_class_id", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="items", + full_name="google.cloud.speech.v1p1beta1.CustomClass.items", + index=2, + number=3, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + ], + extensions=[], + nested_types=[_CUSTOMCLASS_CLASSITEM,], + enum_types=[], + serialized_options=b"\352Ai\n!speech.googleapis.com/CustomClass\022Dprojects/{project}/locations/{location}/customClasses/{custom_class}", + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=143, + serialized_end=402, +) + + +_PHRASESET_PHRASE = _descriptor.Descriptor( + name="Phrase", + full_name="google.cloud.speech.v1p1beta1.PhraseSet.Phrase", + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name="value", + full_name="google.cloud.speech.v1p1beta1.PhraseSet.Phrase.value", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="boost", + full_name="google.cloud.speech.v1p1beta1.PhraseSet.Phrase.boost", + index=1, + number=2, + type=2, + cpp_type=6, + label=1, + has_default_value=False, + default_value=float(0), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=513, + serialized_end=551, +) + +_PHRASESET = _descriptor.Descriptor( + name="PhraseSet", + full_name="google.cloud.speech.v1p1beta1.PhraseSet", + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.speech.v1p1beta1.PhraseSet.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="phrases", + full_name="google.cloud.speech.v1p1beta1.PhraseSet.phrases", + index=1, + number=2, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="boost", + full_name="google.cloud.speech.v1p1beta1.PhraseSet.boost", + index=2, + number=4, + type=2, + cpp_type=6, + label=1, + has_default_value=False, + default_value=float(0), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + ], + extensions=[], + nested_types=[_PHRASESET_PHRASE,], + enum_types=[], + serialized_options=b"\352Ab\n\037speech.googleapis.com/PhraseSet\022?projects/{project}/locations/{location}/phraseSets/{phrase_set}", + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=405, + serialized_end=654, +) + + +_SPEECHADAPTATION = _descriptor.Descriptor( + name="SpeechAdaptation", + full_name="google.cloud.speech.v1p1beta1.SpeechAdaptation", + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name="phrase_sets", + full_name="google.cloud.speech.v1p1beta1.SpeechAdaptation.phrase_sets", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + _descriptor.FieldDescriptor( + name="custom_classes", + full_name="google.cloud.speech.v1p1beta1.SpeechAdaptation.custom_classes", + index=1, + number=2, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=657, + serialized_end=806, +) + +_CUSTOMCLASS_CLASSITEM.containing_type = _CUSTOMCLASS +_CUSTOMCLASS.fields_by_name["items"].message_type = _CUSTOMCLASS_CLASSITEM +_PHRASESET_PHRASE.containing_type = _PHRASESET +_PHRASESET.fields_by_name["phrases"].message_type = _PHRASESET_PHRASE +_SPEECHADAPTATION.fields_by_name["phrase_sets"].message_type = _PHRASESET +_SPEECHADAPTATION.fields_by_name["custom_classes"].message_type = _CUSTOMCLASS +DESCRIPTOR.message_types_by_name["CustomClass"] = _CUSTOMCLASS +DESCRIPTOR.message_types_by_name["PhraseSet"] = _PHRASESET +DESCRIPTOR.message_types_by_name["SpeechAdaptation"] = _SPEECHADAPTATION +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +CustomClass = _reflection.GeneratedProtocolMessageType( + "CustomClass", + (_message.Message,), + { + "ClassItem": _reflection.GeneratedProtocolMessageType( + "ClassItem", + (_message.Message,), + { + "DESCRIPTOR": _CUSTOMCLASS_CLASSITEM, + "__module__": "google.cloud.speech_v1p1beta1.proto.resource_pb2", + "__doc__": """An item of the class. + + Attributes: + value: + The class item’s value. + """, + # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.CustomClass.ClassItem) + }, + ), + "DESCRIPTOR": _CUSTOMCLASS, + "__module__": "google.cloud.speech_v1p1beta1.proto.resource_pb2", + "__doc__": """A set of words or phrases that represents a common concept likely to + appear in your audio, for example a list of passenger ship names. + CustomClass items can be substituted into placeholders that you set in + PhraseSet phrases. + + Attributes: + name: + The resource name of the custom class. + custom_class_id: + If this custom class is a resource, the custom_class_id is the + resource id of the CustomClass. + items: + A collection of class items. + """, + # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.CustomClass) + }, +) +_sym_db.RegisterMessage(CustomClass) +_sym_db.RegisterMessage(CustomClass.ClassItem) + +PhraseSet = _reflection.GeneratedProtocolMessageType( + "PhraseSet", + (_message.Message,), + { + "Phrase": _reflection.GeneratedProtocolMessageType( + "Phrase", + (_message.Message,), + { + "DESCRIPTOR": _PHRASESET_PHRASE, + "__module__": "google.cloud.speech_v1p1beta1.proto.resource_pb2", + "__doc__": """A phrases containing words and phrase “hints” so that the speech + recognition is more likely to recognize them. This can be used to + improve the accuracy for specific words and phrases, for example, if + specific commands are typically spoken by the user. This can also be + used to add additional words to the vocabulary of the recognizer. See + `usage limits `__. List items can also include pre-built or + custom classes containing groups of words that represent common + concepts that occur in natural language. For example, rather than + providing a phrase hint for every month of the year (e.g. “i was born + in january”, “i was born in febuary”, …), use the pre-built ``$MONTH`` + class improves the likelihood of correctly transcribing audio that + includes months (e.g. "i was born in :math:`month"). To refer to pre- + built classes, use the class' symbol prepended with ``\ ``e.g.``\$MONTH\ ``. + To refer to custom classes that were defined inline in the + request, set the class's``\ custom_class_id\ ``to a string unique to + all class resources and inline classes. Then use the class' id wrapped + in $``\ {…}``e.g. "${my-months}". To refer to custom classes + resources, use the class' id wrapped in``\ :math:`{}` (e.g. ``\ {my-months}``). + + Attributes: + value: + The phrase itself. + boost: + Hint Boost. Overrides the boost set at the phrase set level. + Positive value will increase the probability that a specific + phrase will be recognized over other similar sounding phrases. + The higher the boost, the higher the chance of false positive + recognition as well. Negative boost values would correspond to + anti-biasing. Anti-biasing is not enabled, so negative boost + will simply be ignored. Though ``boost`` can accept a wide + range of positive values, most use cases are best served with + values between 0 and 20. We recommend using a binary search + approach to finding the optimal value for your use case. + Speech recognition will skip PhraseSets with a boost value of + 0. + """, + # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.PhraseSet.Phrase) + }, + ), + "DESCRIPTOR": _PHRASESET, + "__module__": "google.cloud.speech_v1p1beta1.proto.resource_pb2", + "__doc__": """Provides “hints” to the speech recognizer to favor specific words and + phrases in the results. + + Attributes: + name: + The resource name of the phrase set. + phrases: + A list of word and phrases. + boost: + Hint Boost. Positive value will increase the probability that + a specific phrase will be recognized over other similar + sounding phrases. The higher the boost, the higher the chance + of false positive recognition as well. Negative boost values + would correspond to anti-biasing. Anti-biasing is not enabled, + so negative boost will simply be ignored. Though ``boost`` can + accept a wide range of positive values, most use cases are + best served with values between 0 (exclusive) and 20. We + recommend using a binary search approach to finding the + optimal value for your use case. Speech recognition will skip + PhraseSets with a boost value of 0. + """, + # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.PhraseSet) + }, +) +_sym_db.RegisterMessage(PhraseSet) +_sym_db.RegisterMessage(PhraseSet.Phrase) + +SpeechAdaptation = _reflection.GeneratedProtocolMessageType( + "SpeechAdaptation", + (_message.Message,), + { + "DESCRIPTOR": _SPEECHADAPTATION, + "__module__": "google.cloud.speech_v1p1beta1.proto.resource_pb2", + "__doc__": """Speech adaptation configuration. + + Attributes: + phrase_sets: + A collection of phrase sets. To specify the hints inline, + leave the phrase set’s ``name`` blank and fill in the rest of + its fields. Any phrase set can use any custom class. + custom_classes: + A collection of custom classes. To specify the classes inline, + leave the class’ ``name`` blank and fill in the rest of its + fields, giving it a unique ``custom_class_id``. Refer to the + inline defined class in phrase hints by its + ``custom_class_id``. + """, + # @@protoc_insertion_point(class_scope:google.cloud.speech.v1p1beta1.SpeechAdaptation) + }, +) +_sym_db.RegisterMessage(SpeechAdaptation) + + +DESCRIPTOR._options = None +_CUSTOMCLASS._options = None +_PHRASESET._options = None +# @@protoc_insertion_point(module_scope) diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/resource_pb2_grpc.py b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/resource_pb2_grpc.py new file mode 100644 index 000000000000..8a9393943bdf --- /dev/null +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/proto/resource_pb2_grpc.py @@ -0,0 +1,3 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc diff --git a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/types.py b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/types.py index 35c7a2c09519..6b4b13c2a400 100644 --- a/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/types.py +++ b/packages/google-cloud-python-speech/google/cloud/speech_v1p1beta1/types.py @@ -21,6 +21,7 @@ from google.api_core.protobuf_helpers import get_messages from google.cloud.speech_v1p1beta1.proto import cloud_speech_pb2 +from google.cloud.speech_v1p1beta1.proto import resource_pb2 from google.longrunning import operations_pb2 from google.protobuf import any_pb2 from google.protobuf import duration_pb2 @@ -28,9 +29,18 @@ from google.rpc import status_pb2 -_shared_modules = [operations_pb2, any_pb2, duration_pb2, timestamp_pb2, status_pb2] +_shared_modules = [ + operations_pb2, + any_pb2, + duration_pb2, + timestamp_pb2, + status_pb2, +] -_local_modules = [cloud_speech_pb2] +_local_modules = [ + cloud_speech_pb2, + resource_pb2, +] names = [] diff --git a/packages/google-cloud-python-speech/noxfile.py b/packages/google-cloud-python-speech/noxfile.py index 4cbae3caffc4..388d62e44133 100644 --- a/packages/google-cloud-python-speech/noxfile.py +++ b/packages/google-cloud-python-speech/noxfile.py @@ -23,14 +23,15 @@ import nox -BLACK_VERSION = "black==19.3b0" +BLACK_VERSION = "black==19.10b0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] -if os.path.exists("samples"): - BLACK_PATHS.append("samples") +DEFAULT_PYTHON_VERSION = "3.8" +SYSTEM_TEST_PYTHON_VERSIONS = ["2.7", "3.8"] +UNIT_TEST_PYTHON_VERSIONS = ["2.7", "3.5", "3.6", "3.7", "3.8"] -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def lint(session): """Run linters. @@ -38,7 +39,9 @@ def lint(session): serious code quality issues. """ session.install("flake8", BLACK_VERSION) - session.run("black", "--check", *BLACK_PATHS) + session.run( + "black", "--check", *BLACK_PATHS, + ) session.run("flake8", "google", "tests") @@ -53,10 +56,12 @@ def blacken(session): check the state of the `gcp_ubuntu_config` we use for that Kokoro run. """ session.install(BLACK_VERSION) - session.run("black", *BLACK_PATHS) + session.run( + "black", *BLACK_PATHS, + ) -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def lint_setup_py(session): """Verify that setup.py is valid (including RST check).""" session.install("docutils", "pygments") @@ -72,6 +77,7 @@ def default(session): session.run( "py.test", "--quiet", + "--cov=google.cloud.speech", "--cov=google.cloud", "--cov=tests.unit", "--cov-append", @@ -83,13 +89,13 @@ def default(session): ) -@nox.session(python=["2.7", "3.5", "3.6", "3.7", "3.8"]) +@nox.session(python=UNIT_TEST_PYTHON_VERSIONS) def unit(session): """Run the unit test suite.""" default(session) -@nox.session(python=["2.7", "3.7"]) +@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" system_test_path = os.path.join("tests", "system.py") @@ -109,8 +115,9 @@ def system(session): # Install all test dependencies, then install this package into the # virtualenv's dist-packages. - session.install("mock", "pytest") - + session.install( + "mock", "pytest", "google-cloud-testutils", + ) session.install("-e", ".") # Run py.test against the system tests. @@ -120,25 +127,7 @@ def system(session): session.run("py.test", "--quiet", system_test_folder_path, *session.posargs) -@nox.session(python=["3.7"]) -def samples(session): - """Run the sample test suite.""" - # Sanity check: Only run tests if the environment variable is set. - if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): - session.skip("Credentials must be set via environment variable") - - samples_path = "samples" - if not os.path.exists(samples_path): - session.skip("Samples not found.") - - session.install("pyyaml") - session.install("sample-tester") - session.install("-e", ".") - - session.run("sample-tester", samples_path, *session.posargs) - - -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def cover(session): """Run the final coverage report. @@ -151,12 +140,12 @@ def cover(session): session.run("coverage", "erase") -@nox.session(python="3.7") +@nox.session(python=DEFAULT_PYTHON_VERSION) def docs(session): """Build the docs for this library.""" session.install("-e", ".") - session.install("sphinx", "alabaster", "recommonmark") + session.install("sphinx<3.0.0", "alabaster", "recommonmark") shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( diff --git a/packages/google-cloud-python-speech/scripts/decrypt-secrets.sh b/packages/google-cloud-python-speech/scripts/decrypt-secrets.sh new file mode 100755 index 000000000000..ff599eb2af25 --- /dev/null +++ b/packages/google-cloud-python-speech/scripts/decrypt-secrets.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Copyright 2015 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +ROOT=$( dirname "$DIR" ) + +# Work from the project root. +cd $ROOT + +# Use SECRET_MANAGER_PROJECT if set, fallback to cloud-devrel-kokoro-resources. +PROJECT_ID="${SECRET_MANAGER_PROJECT:-cloud-devrel-kokoro-resources}" + +gcloud secrets versions access latest --secret="python-docs-samples-test-env" \ + > testing/test-env.sh +gcloud secrets versions access latest \ + --secret="python-docs-samples-service-account" \ + > testing/service-account.json +gcloud secrets versions access latest \ + --secret="python-docs-samples-client-secrets" \ + > testing/client-secrets.json \ No newline at end of file diff --git a/packages/google-cloud-python-speech/scripts/readme-gen/readme_gen.py b/packages/google-cloud-python-speech/scripts/readme-gen/readme_gen.py new file mode 100644 index 000000000000..d309d6e97518 --- /dev/null +++ b/packages/google-cloud-python-speech/scripts/readme-gen/readme_gen.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python + +# Copyright 2016 Google Inc +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Generates READMEs using configuration defined in yaml.""" + +import argparse +import io +import os +import subprocess + +import jinja2 +import yaml + + +jinja_env = jinja2.Environment( + trim_blocks=True, + loader=jinja2.FileSystemLoader( + os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + +README_TMPL = jinja_env.get_template('README.tmpl.rst') + + +def get_help(file): + return subprocess.check_output(['python', file, '--help']).decode() + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('source') + parser.add_argument('--destination', default='README.rst') + + args = parser.parse_args() + + source = os.path.abspath(args.source) + root = os.path.dirname(source) + destination = os.path.join(root, args.destination) + + jinja_env.globals['get_help'] = get_help + + with io.open(source, 'r') as f: + config = yaml.load(f) + + # This allows get_help to execute in the right directory. + os.chdir(root) + + output = README_TMPL.render(config) + + with io.open(destination, 'w') as f: + f.write(output) + + +if __name__ == '__main__': + main() diff --git a/packages/google-cloud-python-speech/scripts/readme-gen/templates/README.tmpl.rst b/packages/google-cloud-python-speech/scripts/readme-gen/templates/README.tmpl.rst new file mode 100644 index 000000000000..4fd239765b0a --- /dev/null +++ b/packages/google-cloud-python-speech/scripts/readme-gen/templates/README.tmpl.rst @@ -0,0 +1,87 @@ +{# The following line is a lie. BUT! Once jinja2 is done with it, it will + become truth! #} +.. This file is automatically generated. Do not edit this file directly. + +{{product.name}} Python Samples +=============================================================================== + +.. image:: https://gstatic.com/cloudssh/images/open-btn.png + :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor={{folder}}/README.rst + + +This directory contains samples for {{product.name}}. {{product.description}} + +{{description}} + +.. _{{product.name}}: {{product.url}} + +{% if required_api_url %} +To run the sample, you need to enable the API at: {{required_api_url}} +{% endif %} + +{% if required_role %} +To run the sample, you need to have `{{required_role}}` role. +{% endif %} + +{{other_required_steps}} + +{% if setup %} +Setup +------------------------------------------------------------------------------- + +{% for section in setup %} + +{% include section + '.tmpl.rst' %} + +{% endfor %} +{% endif %} + +{% if samples %} +Samples +------------------------------------------------------------------------------- + +{% for sample in samples %} +{{sample.name}} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +{% if not sample.hide_cloudshell_button %} +.. image:: https://gstatic.com/cloudssh/images/open-btn.png + :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor={{folder}}/{{sample.file}},{{folder}}/README.rst +{% endif %} + + +{{sample.description}} + +To run this sample: + +.. code-block:: bash + + $ python {{sample.file}} +{% if sample.show_help %} + + {{get_help(sample.file)|indent}} +{% endif %} + + +{% endfor %} +{% endif %} + +{% if cloud_client_library %} + +The client library +------------------------------------------------------------------------------- + +This sample uses the `Google Cloud Client Library for Python`_. +You can read the documentation for more details on API usage and use GitHub +to `browse the source`_ and `report issues`_. + +.. _Google Cloud Client Library for Python: + https://googlecloudplatform.github.io/google-cloud-python/ +.. _browse the source: + https://github.com/GoogleCloudPlatform/google-cloud-python +.. _report issues: + https://github.com/GoogleCloudPlatform/google-cloud-python/issues + +{% endif %} + +.. _Google Cloud SDK: https://cloud.google.com/sdk/ \ No newline at end of file diff --git a/packages/google-cloud-python-speech/scripts/readme-gen/templates/auth.tmpl.rst b/packages/google-cloud-python-speech/scripts/readme-gen/templates/auth.tmpl.rst new file mode 100644 index 000000000000..1446b94a5e3a --- /dev/null +++ b/packages/google-cloud-python-speech/scripts/readme-gen/templates/auth.tmpl.rst @@ -0,0 +1,9 @@ +Authentication +++++++++++++++ + +This sample requires you to have authentication setup. Refer to the +`Authentication Getting Started Guide`_ for instructions on setting up +credentials for applications. + +.. _Authentication Getting Started Guide: + https://cloud.google.com/docs/authentication/getting-started diff --git a/packages/google-cloud-python-speech/scripts/readme-gen/templates/auth_api_key.tmpl.rst b/packages/google-cloud-python-speech/scripts/readme-gen/templates/auth_api_key.tmpl.rst new file mode 100644 index 000000000000..11957ce2714a --- /dev/null +++ b/packages/google-cloud-python-speech/scripts/readme-gen/templates/auth_api_key.tmpl.rst @@ -0,0 +1,14 @@ +Authentication +++++++++++++++ + +Authentication for this service is done via an `API Key`_. To obtain an API +Key: + +1. Open the `Cloud Platform Console`_ +2. Make sure that billing is enabled for your project. +3. From the **Credentials** page, create a new **API Key** or use an existing + one for your project. + +.. _API Key: + https://developers.google.com/api-client-library/python/guide/aaa_apikeys +.. _Cloud Console: https://console.cloud.google.com/project?_ diff --git a/packages/google-cloud-python-speech/scripts/readme-gen/templates/install_deps.tmpl.rst b/packages/google-cloud-python-speech/scripts/readme-gen/templates/install_deps.tmpl.rst new file mode 100644 index 000000000000..a0406dba8c84 --- /dev/null +++ b/packages/google-cloud-python-speech/scripts/readme-gen/templates/install_deps.tmpl.rst @@ -0,0 +1,29 @@ +Install Dependencies +++++++++++++++++++++ + +#. Clone python-docs-samples and change directory to the sample directory you want to use. + + .. code-block:: bash + + $ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git + +#. Install `pip`_ and `virtualenv`_ if you do not already have them. You may want to refer to the `Python Development Environment Setup Guide`_ for Google Cloud Platform for instructions. + + .. _Python Development Environment Setup Guide: + https://cloud.google.com/python/setup + +#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+. + + .. code-block:: bash + + $ virtualenv env + $ source env/bin/activate + +#. Install the dependencies needed to run the samples. + + .. code-block:: bash + + $ pip install -r requirements.txt + +.. _pip: https://pip.pypa.io/ +.. _virtualenv: https://virtualenv.pypa.io/ diff --git a/packages/google-cloud-python-speech/scripts/readme-gen/templates/install_portaudio.tmpl.rst b/packages/google-cloud-python-speech/scripts/readme-gen/templates/install_portaudio.tmpl.rst new file mode 100644 index 000000000000..5ea33d18c00c --- /dev/null +++ b/packages/google-cloud-python-speech/scripts/readme-gen/templates/install_portaudio.tmpl.rst @@ -0,0 +1,35 @@ +Install PortAudio ++++++++++++++++++ + +Install `PortAudio`_. This is required by the `PyAudio`_ library to stream +audio from your computer's microphone. PyAudio depends on PortAudio for cross-platform compatibility, and is installed differently depending on the +platform. + +* For Mac OS X, you can use `Homebrew`_:: + + brew install portaudio + + **Note**: if you encounter an error when running `pip install` that indicates + it can't find `portaudio.h`, try running `pip install` with the following + flags:: + + pip install --global-option='build_ext' \ + --global-option='-I/usr/local/include' \ + --global-option='-L/usr/local/lib' \ + pyaudio + +* For Debian / Ubuntu Linux:: + + apt-get install portaudio19-dev python-all-dev + +* Windows may work without having to install PortAudio explicitly (it will get + installed with PyAudio). + +For more details, see the `PyAudio installation`_ page. + + +.. _PyAudio: https://people.csail.mit.edu/hubert/pyaudio/ +.. _PortAudio: http://www.portaudio.com/ +.. _PyAudio installation: + https://people.csail.mit.edu/hubert/pyaudio/#downloads +.. _Homebrew: http://brew.sh diff --git a/packages/google-cloud-python-speech/setup.cfg b/packages/google-cloud-python-speech/setup.cfg index 3bd555500e37..c3a2b39f6528 100644 --- a/packages/google-cloud-python-speech/setup.cfg +++ b/packages/google-cloud-python-speech/setup.cfg @@ -1,3 +1,19 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Generated by synthtool. DO NOT EDIT! [bdist_wheel] universal = 1 diff --git a/packages/google-cloud-python-speech/synth.metadata b/packages/google-cloud-python-speech/synth.metadata index 183eecb3f01b..236239699f0a 100644 --- a/packages/google-cloud-python-speech/synth.metadata +++ b/packages/google-cloud-python-speech/synth.metadata @@ -1,26 +1,25 @@ { - "updateTime": "2020-02-03T22:57:22.365987Z", "sources": [ { - "generator": { - "name": "artman", - "version": "0.44.4", - "dockerImage": "googleapis/artman@sha256:19e945954fc960a4bdfee6cb34695898ab21a8cf0bac063ee39b91f00a1faec8" + "git": { + "name": ".", + "remote": "https://github.com/googleapis/python-speech.git", + "sha": "0d4d2c20b131269e532436da0bf6cdabc7d398e8" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "29d40b78e3dc1579b0b209463fbcb76e5767f72a", - "internalRef": "292979741" + "sha": "b882b8e6bfcd708042ff00f7adc67ce750817dd0", + "internalRef": "318028816" } }, { - "template": { - "name": "python_split_library", - "origin": "synthtool.gcp", - "version": "2019.10.17" + "git": { + "name": "synthtool", + "remote": "https://github.com/googleapis/synthtool.git", + "sha": "ce68c0e70d36c93ffcde96e9908fb4d94aa4f2e4" } } ], @@ -31,8 +30,7 @@ "apiName": "speech", "apiVersion": "v1p1beta1", "language": "python", - "generator": "gapic", - "config": "google/cloud/speech/artman_speech_v1p1beta1.yaml" + "generator": "bazel" } }, { @@ -41,8 +39,7 @@ "apiName": "speech", "apiVersion": "v1", "language": "python", - "generator": "gapic", - "config": "google/cloud/speech/artman_speech_v1.yaml" + "generator": "bazel" } } ] diff --git a/packages/google-cloud-python-speech/synth.py b/packages/google-cloud-python-speech/synth.py index 51a141047ed4..649a25019d28 100644 --- a/packages/google-cloud-python-speech/synth.py +++ b/packages/google-cloud-python-speech/synth.py @@ -61,4 +61,7 @@ templated_files = common.py_library(cov_level=87, include_samples=True) s.move(templated_files) +# TODO(busunkim): Use latest sphinx after microgenerator transition +s.replace("noxfile.py", """['"]sphinx['"]""", '"sphinx<3.0.0"') + s.shell.run(["nox", "-s", "blacken"], hide_output=False) diff --git a/packages/google-cloud-python-speech/testing/.gitignore b/packages/google-cloud-python-speech/testing/.gitignore new file mode 100644 index 000000000000..b05fbd630881 --- /dev/null +++ b/packages/google-cloud-python-speech/testing/.gitignore @@ -0,0 +1,3 @@ +test-env.sh +service-account.json +client-secrets.json \ No newline at end of file