diff --git a/packages/google-cloud-language/samples/snippets/README.md b/packages/google-cloud-language/samples/snippets/README.md index 1e4a6401bbd8..d0ba56915559 100644 --- a/packages/google-cloud-language/samples/snippets/README.md +++ b/packages/google-cloud-language/samples/snippets/README.md @@ -1,5 +1,10 @@ # Google Cloud Natural Language API examples +[![Open in Cloud Shell][shell_img]][shell_link] + +[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png +[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=language/README.md + This directory contains Python examples that use the [Google Cloud Natural Language API](https://cloud.google.com/natural-language/). diff --git a/packages/google-cloud-language/samples/snippets/api/README.rst b/packages/google-cloud-language/samples/snippets/api/README.rst index e97059a3919c..7434de167bcc 100644 --- a/packages/google-cloud-language/samples/snippets/api/README.rst +++ b/packages/google-cloud-language/samples/snippets/api/README.rst @@ -3,6 +3,10 @@ Google Cloud Natural Language API 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=language/api/README.rst + + This directory contains samples for Google Cloud Natural Language API. The `Google Cloud Natural Language API`_ provides natural language understanding technologies to developers, including sentiment analysis, entity recognition, and syntax analysis. This API is part of the larger Cloud Machine Learning API. @@ -54,6 +58,10 @@ Samples Analyze syntax +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +.. 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=language/api/analyze.py;language/api/README.rst + + To run this sample: @@ -63,17 +71,18 @@ To run this sample: $ python analyze.py usage: analyze.py [-h] {entities,sentiment,syntax} text - + Analyzes text using the Google Cloud Natural Language API. - + positional arguments: {entities,sentiment,syntax} text - + optional arguments: -h, --help show this help message and exit + .. _Google Cloud SDK: https://cloud.google.com/sdk/ \ No newline at end of file diff --git a/packages/google-cloud-language/samples/snippets/api/README.rst.in b/packages/google-cloud-language/samples/snippets/api/README.rst.in index 31294fae1960..f3195edf6b42 100644 --- a/packages/google-cloud-language/samples/snippets/api/README.rst.in +++ b/packages/google-cloud-language/samples/snippets/api/README.rst.in @@ -18,3 +18,5 @@ samples: - name: Analyze syntax file: analyze.py show_help: true + +folder: language/api \ No newline at end of file diff --git a/packages/google-cloud-language/samples/snippets/classify_text/README.rst b/packages/google-cloud-language/samples/snippets/classify_text/README.rst index 0a61591bc22e..2857e0312309 100644 --- a/packages/google-cloud-language/samples/snippets/classify_text/README.rst +++ b/packages/google-cloud-language/samples/snippets/classify_text/README.rst @@ -3,6 +3,10 @@ Google Cloud Natural Language API 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=language/classify_text/README.rst + + This directory contains samples for Google Cloud Natural Language API. The `Google Cloud Natural Language API`_ provides natural language understanding technologies to developers. This tutorial demostrates how to use the `classify_text` method to classify content category of text files, and use the result to compare texts by their similarity to each other. See the `tutorial page`_ for details about this sample. @@ -21,39 +25,20 @@ Setup Authentication ++++++++++++++ -Authentication is typically done through `Application Default Credentials`_, -which means you do not have to change the code to authenticate as long as -your environment has credentials. You have a few options for setting up -authentication: - -#. When running locally, use the `Google Cloud SDK`_ - - .. code-block:: bash - - gcloud auth application-default login - - -#. When running on App Engine or Compute Engine, credentials are already - set-up. However, you may need to configure your Compute Engine instance - with `additional scopes`_. - -#. You can create a `Service Account key file`_. This file can be used to - authenticate to Google Cloud Platform services from any environment. To use - the file, set the ``GOOGLE_APPLICATION_CREDENTIALS`` environment variable to - the path to the key file, for example: - - .. code-block:: bash - - export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account.json +This sample requires you to have authentication setup. Refer to the +`Authentication Getting Started Guide`_ for instructions on setting up +credentials for applications. -.. _Application Default Credentials: https://cloud.google.com/docs/authentication#getting_credentials_for_server-centric_flow -.. _additional scopes: https://cloud.google.com/compute/docs/authentication#using -.. _Service Account key file: https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount +.. _Authentication Getting Started Guide: + https://cloud.google.com/docs/authentication/getting-started Install Dependencies ++++++++++++++++++++ -#. Install `pip`_ and `virtualenv`_ if you do not already have them. +#. 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+. @@ -77,6 +62,10 @@ Samples Classify Text Tutorial +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +.. 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=language/classify_text/classify_text_tutorial.py;language/classify_text/README.rst + + To run this sample: @@ -87,9 +76,13 @@ To run this sample: usage: classify_text_tutorial.py [-h] {classify,index,query,query-category} ... - - Using the classify_text method to cluster texts. - + + Using the classify_text method to find content categories of text files, + Then use the content category labels to compare text similarity. + + For more information, see the tutorial page at + https://cloud.google.com/natural-language/docs/classify-text-tutorial. + positional arguments: {classify,index,query,query-category} classify Classify the input text into categories. @@ -101,13 +94,14 @@ To run this sample: the query label. The list of all available labels: https://cloud.google.com/natural- language/docs/categories - + optional arguments: -h, --help show this help message and exit + The client library ------------------------------------------------------------------------------- diff --git a/packages/google-cloud-language/samples/snippets/classify_text/README.rst.in b/packages/google-cloud-language/samples/snippets/classify_text/README.rst.in index 42e8f061a5d7..14ee6dc9aa45 100644 --- a/packages/google-cloud-language/samples/snippets/classify_text/README.rst.in +++ b/packages/google-cloud-language/samples/snippets/classify_text/README.rst.in @@ -24,3 +24,5 @@ samples: show_help: true cloud_client_library: true + +folder: language/classify_text \ No newline at end of file diff --git a/packages/google-cloud-language/samples/snippets/cloud-client/v1/README.rst b/packages/google-cloud-language/samples/snippets/cloud-client/v1/README.rst index cf4c07d20b99..2e93e9af13fd 100644 --- a/packages/google-cloud-language/samples/snippets/cloud-client/v1/README.rst +++ b/packages/google-cloud-language/samples/snippets/cloud-client/v1/README.rst @@ -3,6 +3,10 @@ Google Cloud Natural Language API 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=language/cloud-client/v1/README.rst + + This directory contains samples for Google Cloud Natural Language API. The `Google Cloud Natural Language API`_ provides natural language understanding technologies to developers, including sentiment analysis, entity recognition, and syntax analysis. This API is part of the larger Cloud Machine Learning API. - See the `migration guide`_ for information about migrating to Python client library v0.26.1. @@ -58,6 +62,10 @@ Samples Quickstart +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +.. 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=language/cloud-client/v1/quickstart.py;language/cloud-client/v1/README.rst + + To run this sample: @@ -70,6 +78,10 @@ To run this sample: Snippets +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +.. 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=language/cloud-client/v1/snippets.py;language/cloud-client/v1/README.rst + + To run this sample: @@ -79,17 +91,20 @@ To run this sample: $ python snippets.py usage: snippets.py [-h] - {sentiment-entities-text,sentiment-entities-file,sentiment-text,sentiment-file,entities-text,entities-file,syntax-text,syntax-file} + {classify-text,classify-file,sentiment-entities-text,sentiment-entities-file,sentiment-text,sentiment-file,entities-text,entities-file,syntax-text,syntax-file} ... - + This application demonstrates how to perform basic operations with the Google Cloud Natural Language API - + For more information, the documentation at https://cloud.google.com/natural-language/docs. - + positional arguments: - {sentiment-entities-text,sentiment-entities-file,sentiment-text,sentiment-file,entities-text,entities-file,syntax-text,syntax-file} + {classify-text,classify-file,sentiment-entities-text,sentiment-entities-file,sentiment-text,sentiment-file,entities-text,entities-file,syntax-text,syntax-file} + classify-text Classifies content categories of the provided text. + classify-file Classifies content categories of the text in a Google + Cloud Storage file. sentiment-entities-text Detects entity sentiment in the provided text. sentiment-entities-file @@ -104,13 +119,14 @@ To run this sample: syntax-text Detects syntax in the text. syntax-file Detects syntax in the file located in Google Cloud Storage. - + optional arguments: -h, --help show this help message and exit + The client library ------------------------------------------------------------------------------- diff --git a/packages/google-cloud-language/samples/snippets/cloud-client/v1/README.rst.in b/packages/google-cloud-language/samples/snippets/cloud-client/v1/README.rst.in index 1b4855fb4f38..06b7ff3e1953 100644 --- a/packages/google-cloud-language/samples/snippets/cloud-client/v1/README.rst.in +++ b/packages/google-cloud-language/samples/snippets/cloud-client/v1/README.rst.in @@ -28,3 +28,5 @@ samples: show_help: true cloud_client_library: true + +folder: language/cloud-client/v1 \ No newline at end of file diff --git a/packages/google-cloud-language/samples/snippets/cloud-client/v1beta2/README.rst b/packages/google-cloud-language/samples/snippets/cloud-client/v1beta2/README.rst index f2ec309a64e0..aa4ce4524827 100644 --- a/packages/google-cloud-language/samples/snippets/cloud-client/v1beta2/README.rst +++ b/packages/google-cloud-language/samples/snippets/cloud-client/v1beta2/README.rst @@ -3,6 +3,10 @@ Google Cloud Natural Language API 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=language/cloud-client/v1beta2/README.rst + + This directory contains samples for Google Cloud Natural Language API. The `Google Cloud Natural Language API`_ provides natural language understanding technologies to developers, including sentiment analysis, entity recognition, and syntax analysis. This API is part of the larger Cloud Machine Learning API. - See the `migration guide`_ for information about migrating to Python client library v0.26.1. @@ -58,6 +62,10 @@ Samples Quickstart +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +.. 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=language/cloud-client/v1beta2/quickstart.py;language/cloud-client/v1beta2/README.rst + + To run this sample: @@ -70,6 +78,10 @@ To run this sample: Snippets +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +.. 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=language/cloud-client/v1beta2/snippets.py;language/cloud-client/v1beta2/README.rst + + To run this sample: @@ -81,13 +93,13 @@ To run this sample: usage: snippets.py [-h] {classify-text,classify-file,sentiment-entities-text,sentiment-entities-file,sentiment-text,sentiment-file,entities-text,entities-file,syntax-text,syntax-file} ... - + This application demonstrates how to perform basic operations with the Google Cloud Natural Language API - + For more information, the documentation at https://cloud.google.com/natural-language/docs. - + positional arguments: {classify-text,classify-file,sentiment-entities-text,sentiment-entities-file,sentiment-text,sentiment-file,entities-text,entities-file,syntax-text,syntax-file} classify-text Classifies content categories of the provided text. @@ -107,13 +119,14 @@ To run this sample: syntax-text Detects syntax in the text. syntax-file Detects syntax in the file located in Google Cloud Storage. - + optional arguments: -h, --help show this help message and exit + The client library ------------------------------------------------------------------------------- diff --git a/packages/google-cloud-language/samples/snippets/cloud-client/v1beta2/README.rst.in b/packages/google-cloud-language/samples/snippets/cloud-client/v1beta2/README.rst.in index 1b4855fb4f38..d11667458a5a 100644 --- a/packages/google-cloud-language/samples/snippets/cloud-client/v1beta2/README.rst.in +++ b/packages/google-cloud-language/samples/snippets/cloud-client/v1beta2/README.rst.in @@ -28,3 +28,5 @@ samples: show_help: true cloud_client_library: true + +folder: language/cloud-client/v1beta2 \ No newline at end of file diff --git a/packages/google-cloud-language/samples/snippets/movie_nl/README.md b/packages/google-cloud-language/samples/snippets/movie_nl/README.md index 687a6c4058ab..95c05dbbce12 100644 --- a/packages/google-cloud-language/samples/snippets/movie_nl/README.md +++ b/packages/google-cloud-language/samples/snippets/movie_nl/README.md @@ -1,4 +1,9 @@ # Introduction + +[![Open in Cloud Shell][shell_img]][shell_link] + +[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png +[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=language/movie_nl/README.md This sample is an application of the Google Cloud Platform Natural Language API. It uses the [imdb movie reviews data set](https://www.cs.cornell.edu/people/pabo/movie-review-data/) from [Cornell University](http://www.cs.cornell.edu/) and performs sentiment & entity diff --git a/packages/google-cloud-language/samples/snippets/ocr_nl/README.md b/packages/google-cloud-language/samples/snippets/ocr_nl/README.md index 189e93979010..a34ff3179c4c 100644 --- a/packages/google-cloud-language/samples/snippets/ocr_nl/README.md +++ b/packages/google-cloud-language/samples/snippets/ocr_nl/README.md @@ -1,4 +1,9 @@ + +[![Open in Cloud Shell][shell_img]][shell_link] + +[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png +[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=language/ocr_nl/README.md # Using the Cloud Natural Language API to analyze image text found with Cloud Vision This example uses the [Cloud Vision API](https://cloud.google.com/vision/) to diff --git a/packages/google-cloud-language/samples/snippets/sentiment/README.md b/packages/google-cloud-language/samples/snippets/sentiment/README.md index 955629931ee0..313817ef2fe1 100644 --- a/packages/google-cloud-language/samples/snippets/sentiment/README.md +++ b/packages/google-cloud-language/samples/snippets/sentiment/README.md @@ -1,5 +1,10 @@ # Introduction +[![Open in Cloud Shell][shell_img]][shell_link] + +[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png +[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=language/sentiment/README.md + This sample contains the code referenced in the [Sentiment Analysis Tutorial](http://cloud.google.com/natural-language/docs/sentiment-tutorial) within the Google Cloud Natural Language API Documentation. A full walkthrough of this sample diff --git a/packages/google-cloud-language/samples/snippets/syntax_triples/README.md b/packages/google-cloud-language/samples/snippets/syntax_triples/README.md index 1342ee65289d..551057e7217d 100644 --- a/packages/google-cloud-language/samples/snippets/syntax_triples/README.md +++ b/packages/google-cloud-language/samples/snippets/syntax_triples/README.md @@ -1,5 +1,10 @@ # Using the Cloud Natural Language API to find subject-verb-object triples in text +[![Open in Cloud Shell][shell_img]][shell_link] + +[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png +[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=language/syntax_triples/README.md + This example finds subject-verb-object triples in a given piece of text using syntax analysis capabilities of [Cloud Natural Language API](https://cloud.google.com/natural-language/). diff --git a/packages/google-cloud-language/samples/snippets/tutorial/README.rst b/packages/google-cloud-language/samples/snippets/tutorial/README.rst index 651b219cad1d..202381a6f350 100644 --- a/packages/google-cloud-language/samples/snippets/tutorial/README.rst +++ b/packages/google-cloud-language/samples/snippets/tutorial/README.rst @@ -3,6 +3,10 @@ Google Cloud Natural Language Tutorial 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=language/tutorial/README.rst + + This directory contains samples for Google Cloud Natural Language Tutorial. The `Google Cloud Natural Language API`_ provides natural language understanding technologies to developers, including sentiment analysis, entity recognition, and syntax analysis. This API is part of the larger Cloud Machine Learning API. @@ -54,6 +58,10 @@ Samples Language tutorial +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +.. 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=language/tutorial/tutorial.py;language/tutorial/README.rst + + To run this sample: @@ -63,16 +71,17 @@ To run this sample: $ python tutorial.py usage: tutorial.py [-h] movie_review_filename - + positional arguments: movie_review_filename The filename of the movie review you'd like to analyze. - + optional arguments: -h, --help show this help message and exit + .. _Google Cloud SDK: https://cloud.google.com/sdk/ \ No newline at end of file diff --git a/packages/google-cloud-language/samples/snippets/tutorial/README.rst.in b/packages/google-cloud-language/samples/snippets/tutorial/README.rst.in index aea593b277f4..945c701e510e 100644 --- a/packages/google-cloud-language/samples/snippets/tutorial/README.rst.in +++ b/packages/google-cloud-language/samples/snippets/tutorial/README.rst.in @@ -18,3 +18,5 @@ samples: - name: Language tutorial file: tutorial.py show_help: true + +folder: language/tutorial \ No newline at end of file