Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write synthesis script, regenerate library #5577

Merged
merged 2 commits into from
Jul 9, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 78 additions & 35 deletions speech/README.rst
Original file line number Diff line number Diff line change
@@ -1,54 +1,97 @@
Python Client for Google Cloud Speech
=====================================
Python Client for Google Cloud Speech API (`Beta`_)
====================================================

Python idiomatic client for `Google Cloud Speech`_
`Google Cloud Speech API`_: Google Cloud Speech API.

.. _Google Cloud Speech: https://cloud.google.com/speech/
- `Client Library Documentation`_
- `Product Documentation`_

|pypi| |versions|

- `Documentation`_

.. _Documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/speech/
.. _Alpha: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst
.. _Google Cloud Speech API: https://cloud.google.com/speech
.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/speech/usage.html
.. _Product Documentation: https://cloud.google.com/speech

Quick Start
-----------

In order to use this library, you first need to go through the following steps:

1. `Select or create a Cloud Platform project.`_
2. `Enable billing for your project.`_
3. `Enable the Google Cloud Speech API.`_
4. `Setup Authentication.`_

.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
.. _Enable the Google Cloud Speech API.: https://cloud.google.com/speech
.. _Setup Authentication.: https://googlecloudplatform.github.io/google-cloud-python/stable/core/auth.html

Installation
~~~~~~~~~~~~

Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to
create isolated Python environments. The basic problem it addresses is one of
dependencies and versions, and indirectly permissions.

With `virtualenv`_, it's possible to install this library without needing system
install permissions, and without clashing with the installed system
dependencies.

.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/


Mac/Linux
^^^^^^^^^

.. code-block:: console

pip install virtualenv
virtualenv <your-env>
source <your-env>/bin/activate
<your-env>/bin/pip install google-cloud-speech


Windows
^^^^^^^

.. code-block:: console

$ pip install --upgrade google-cloud-speech
pip install virtualenv
virtualenv <your-env>
<your-env>\Scripts\activate
<your-env>\Scripts\pip.exe install google-cloud-speech

For more information on setting up your Python development environment,
such as installing ``pip`` and ``virtualenv`` on your system, please refer
to `Python Development Environment Setup Guide`_ for Google Cloud Platform.
Preview
~~~~~~~

.. _Python Development Environment Setup Guide: https://cloud.google.com/python/setup
SpeechClient
^^^^^^^^^^^^

Authentication
--------------
.. code:: py

With ``google-cloud-python`` we try to make authentication as painless as
possible. Check out the `Authentication section`_ in our documentation to
learn more. You may also find the `authentication document`_ shared by all
the ``google-cloud-*`` libraries to be helpful.
from google.cloud import speech_v1
from google.cloud.speech_v1 import enums

.. _Authentication section: https://google-cloud-python.readthedocs.io/en/latest/core/auth.html
.. _authentication document: https://github.com/GoogleCloudPlatform/google-cloud-common/tree/master/authentication
client = speech_v1.SpeechClient()

Using the API
-------------
encoding = enums.RecognitionConfig.AudioEncoding.FLAC
sample_rate_hertz = 44100
language_code = 'en-US'
config = {'encoding': encoding, 'sample_rate_hertz': sample_rate_hertz, 'language_code': language_code}
uri = 'gs://bucket_name/file_name.flac'
audio = {'uri': uri}

`Cloud Speech API`_ enables easy integration of Google speech
recognition technologies into developer applications. Send audio
and receive a text transcription from the Cloud Speech API service.
response = client.recognize(config, audio)

.. _Cloud Speech API: https://cloud.google.com/speech/
Next Steps
~~~~~~~~~~

See the ``google-cloud-python`` API `speech documentation`_ to learn how to
connect to the Google Cloud Speech API using this Client Library.
- Read the `Client Library Documentation`_ for Google Cloud Speech API
API to see other available methods on the client.
- Read the `Google Cloud Speech API Product documentation`_ to learn
more about the product and see How-to Guides.
- View this `repository’s main README`_ to see the full list of Cloud
APIs that we cover.

.. _speech documentation: https://googlecloudplatform.github.io/google-cloud-python/latest/speech/
.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-speech.svg
:target: https://pypi.org/project/google-cloud-speech/
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-speech.svg
:target: https://pypi.org/project/google-cloud-speech/
.. _Google Cloud Speech API Product documentation: https://cloud.google.com/speech
.. _repository’s main README: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst
6 changes: 6 additions & 0 deletions speech/docs/gapic/v1/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Client for Google Cloud Speech API
==================================

.. automodule:: google.cloud.speech_v1
:members:
:inherited-members:
5 changes: 5 additions & 0 deletions speech/docs/gapic/v1/types.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Types for Google Cloud Speech API Client
========================================

.. automodule:: google.cloud.speech_v1.types
:members:
6 changes: 6 additions & 0 deletions speech/docs/gapic/v1p1beta1/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Client for Cloud Speech API
===========================

.. automodule:: google.cloud.speech_v1p1beta1
:members:
:inherited-members:
5 changes: 5 additions & 0 deletions speech/docs/gapic/v1p1beta1/types.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Types for Cloud Speech API Client
=================================

.. automodule:: google.cloud.speech_v1p1beta1.types
:members:
108 changes: 108 additions & 0 deletions speech/docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
Python Client for Google Cloud Speech API (`Beta`_)
====================================================

`Google Cloud Speech API`_: Google Cloud Speech API.

- `Client Library Documentation`_
- `Product Documentation`_

.. _Alpha: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst
.. _Google Cloud Speech API: https://cloud.google.com/speech
.. _Client Library Documentation: https://googlecloudplatform.github.io/google-cloud-python/stable/speech/usage.html
.. _Product Documentation: https://cloud.google.com/speech

Quick Start
-----------

In order to use this library, you first need to go through the following steps:

1. `Select or create a Cloud Platform project.`_
2. `Enable billing for your project.`_
3. `Enable the Google Cloud Speech API.`_
4. `Setup Authentication.`_

.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
.. _Enable the Google Cloud Speech API.: https://cloud.google.com/speech
.. _Setup Authentication.: https://googlecloudplatform.github.io/google-cloud-python/stable/core/auth.html

Installation
~~~~~~~~~~~~

Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to
create isolated Python environments. The basic problem it addresses is one of
dependencies and versions, and indirectly permissions.

With `virtualenv`_, it's possible to install this library without needing system
install permissions, and without clashing with the installed system
dependencies.

.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/


Mac/Linux
^^^^^^^^^

.. code-block:: console

pip install virtualenv
virtualenv <your-env>
source <your-env>/bin/activate
<your-env>/bin/pip install google-cloud-speech


Windows
^^^^^^^

.. code-block:: console

pip install virtualenv
virtualenv <your-env>
<your-env>\Scripts\activate
<your-env>\Scripts\pip.exe install google-cloud-speech

Preview
~~~~~~~

SpeechClient
^^^^^^^^^^^^

.. code:: py

from google.cloud import speech_v1
from google.cloud.speech_v1 import enums

client = speech_v1.SpeechClient()

encoding = enums.RecognitionConfig.AudioEncoding.FLAC
sample_rate_hertz = 44100
language_code = 'en-US'
config = {'encoding': encoding, 'sample_rate_hertz': sample_rate_hertz, 'language_code': language_code}
uri = 'gs://bucket_name/file_name.flac'
audio = {'uri': uri}

response = client.recognize(config, audio)

Next Steps
~~~~~~~~~~

- Read the `Client Library Documentation`_ for Google Cloud Speech API
API to see other available methods on the client.
- Read the `Google Cloud Speech API Product documentation`_ to learn
more about the product and see How-to Guides.
- View this `repository’s main README`_ to see the full list of Cloud
APIs that we cover.

.. _Google Cloud Speech API Product documentation: https://cloud.google.com/speech
.. _repository’s main README: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/master/README.rst

Api Reference
-------------
.. toctree::
:maxdepth: 2

gapic/v1/api
gapic/v1/types
gapic/v1p1beta1/api
gapic/v1p1beta1/types
changelog
6 changes: 4 additions & 2 deletions speech/google/cloud/speech_v1/gapic/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
# limitations under the License.
"""Wrappers for protocol buffer enum types."""

import enum


class RecognitionConfig(object):
class AudioEncoding(object):
class AudioEncoding(enum.IntEnum):
"""
Audio encoding of the data sent in the audio message. All encodings support
only 1 channel (mono) audio. Only ``FLAC`` and ``WAV`` include a header that
Expand Down Expand Up @@ -68,7 +70,7 @@ class AudioEncoding(object):


class StreamingRecognizeResponse(object):
class SpeechEventType(object):
class SpeechEventType(enum.IntEnum):
"""
Indicates the type of speech event.

Expand Down
Loading