Skip to content

Commit 15ecc88

Browse files
michaelawyubusunkim96
authored andcommitted
Added "Open in Cloud Shell" buttons to README files [(#1254)](#1254)
1 parent b62c6be commit 15ecc88

File tree

15 files changed

+123
-47
lines changed

15 files changed

+123
-47
lines changed

language/snippets/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Google Cloud Natural Language API examples
22

3+
[![Open in Cloud Shell][shell_img]][shell_link]
4+
5+
[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png
6+
[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
7+
38
This directory contains Python examples that use the
49
[Google Cloud Natural Language API](https://cloud.google.com/natural-language/).
510

language/snippets/api/README.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
Google Cloud Natural Language API Python Samples
44
===============================================================================
55

6+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
7+
: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
8+
9+
610
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.
711

812

@@ -54,6 +58,10 @@ Samples
5458
Analyze syntax
5559
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5660

61+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
62+
: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
63+
64+
5765

5866

5967
To run this sample:
@@ -63,17 +71,18 @@ To run this sample:
6371
$ python analyze.py
6472
6573
usage: analyze.py [-h] {entities,sentiment,syntax} text
66-
74+
6775
Analyzes text using the Google Cloud Natural Language API.
68-
76+
6977
positional arguments:
7078
{entities,sentiment,syntax}
7179
text
72-
80+
7381
optional arguments:
7482
-h, --help show this help message and exit
7583
7684
7785
7886
87+
7988
.. _Google Cloud SDK: https://cloud.google.com/sdk/

language/snippets/api/README.rst.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ samples:
1818
- name: Analyze syntax
1919
file: analyze.py
2020
show_help: true
21+
22+
folder: language/api

language/snippets/classify_text/README.rst

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
Google Cloud Natural Language API Python Samples
44
===============================================================================
55

6+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
7+
: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
8+
9+
610
This directory contains samples for Google Cloud Natural Language API. The `Google Cloud Natural Language API`_ provides natural language understanding technologies to developers.
711

812
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
2125
Authentication
2226
++++++++++++++
2327

24-
Authentication is typically done through `Application Default Credentials`_,
25-
which means you do not have to change the code to authenticate as long as
26-
your environment has credentials. You have a few options for setting up
27-
authentication:
28-
29-
#. When running locally, use the `Google Cloud SDK`_
30-
31-
.. code-block:: bash
32-
33-
gcloud auth application-default login
34-
35-
36-
#. When running on App Engine or Compute Engine, credentials are already
37-
set-up. However, you may need to configure your Compute Engine instance
38-
with `additional scopes`_.
39-
40-
#. You can create a `Service Account key file`_. This file can be used to
41-
authenticate to Google Cloud Platform services from any environment. To use
42-
the file, set the ``GOOGLE_APPLICATION_CREDENTIALS`` environment variable to
43-
the path to the key file, for example:
44-
45-
.. code-block:: bash
46-
47-
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account.json
28+
This sample requires you to have authentication setup. Refer to the
29+
`Authentication Getting Started Guide`_ for instructions on setting up
30+
credentials for applications.
4831

49-
.. _Application Default Credentials: https://cloud.google.com/docs/authentication#getting_credentials_for_server-centric_flow
50-
.. _additional scopes: https://cloud.google.com/compute/docs/authentication#using
51-
.. _Service Account key file: https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount
32+
.. _Authentication Getting Started Guide:
33+
https://cloud.google.com/docs/authentication/getting-started
5234

5335
Install Dependencies
5436
++++++++++++++++++++
5537

56-
#. Install `pip`_ and `virtualenv`_ if you do not already have them.
38+
#. 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.
39+
40+
.. _Python Development Environment Setup Guide:
41+
https://cloud.google.com/python/setup
5742

5843
#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.
5944

@@ -77,6 +62,10 @@ Samples
7762
Classify Text Tutorial
7863
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7964

65+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
66+
: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
67+
68+
8069

8170

8271
To run this sample:
@@ -87,9 +76,13 @@ To run this sample:
8776
8877
usage: classify_text_tutorial.py [-h]
8978
{classify,index,query,query-category} ...
90-
91-
Using the classify_text method to cluster texts.
92-
79+
80+
Using the classify_text method to find content categories of text files,
81+
Then use the content category labels to compare text similarity.
82+
83+
For more information, see the tutorial page at
84+
https://cloud.google.com/natural-language/docs/classify-text-tutorial.
85+
9386
positional arguments:
9487
{classify,index,query,query-category}
9588
classify Classify the input text into categories.
@@ -101,13 +94,14 @@ To run this sample:
10194
the query label. The list of all available labels:
10295
https://cloud.google.com/natural-
10396
language/docs/categories
104-
97+
10598
optional arguments:
10699
-h, --help show this help message and exit
107100
108101
109102
110103
104+
111105
The client library
112106
-------------------------------------------------------------------------------
113107

language/snippets/classify_text/README.rst.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ samples:
2424
show_help: true
2525

2626
cloud_client_library: true
27+
28+
folder: language/classify_text

language/snippets/cloud-client/v1/README.rst

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
Google Cloud Natural Language API Python Samples
44
===============================================================================
55

6+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
7+
: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
8+
9+
610
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.
711

812
- See the `migration guide`_ for information about migrating to Python client library v0.26.1.
@@ -58,6 +62,10 @@ Samples
5862
Quickstart
5963
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6064

65+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
66+
: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
67+
68+
6169

6270

6371
To run this sample:
@@ -70,6 +78,10 @@ To run this sample:
7078
Snippets
7179
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7280

81+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
82+
: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
83+
84+
7385

7486

7587
To run this sample:
@@ -79,17 +91,20 @@ To run this sample:
7991
$ python snippets.py
8092
8193
usage: snippets.py [-h]
82-
{sentiment-entities-text,sentiment-entities-file,sentiment-text,sentiment-file,entities-text,entities-file,syntax-text,syntax-file}
94+
{classify-text,classify-file,sentiment-entities-text,sentiment-entities-file,sentiment-text,sentiment-file,entities-text,entities-file,syntax-text,syntax-file}
8395
...
84-
96+
8597
This application demonstrates how to perform basic operations with the
8698
Google Cloud Natural Language API
87-
99+
88100
For more information, the documentation at
89101
https://cloud.google.com/natural-language/docs.
90-
102+
91103
positional arguments:
92-
{sentiment-entities-text,sentiment-entities-file,sentiment-text,sentiment-file,entities-text,entities-file,syntax-text,syntax-file}
104+
{classify-text,classify-file,sentiment-entities-text,sentiment-entities-file,sentiment-text,sentiment-file,entities-text,entities-file,syntax-text,syntax-file}
105+
classify-text Classifies content categories of the provided text.
106+
classify-file Classifies content categories of the text in a Google
107+
Cloud Storage file.
93108
sentiment-entities-text
94109
Detects entity sentiment in the provided text.
95110
sentiment-entities-file
@@ -104,13 +119,14 @@ To run this sample:
104119
syntax-text Detects syntax in the text.
105120
syntax-file Detects syntax in the file located in Google Cloud
106121
Storage.
107-
122+
108123
optional arguments:
109124
-h, --help show this help message and exit
110125
111126
112127
113128
129+
114130
The client library
115131
-------------------------------------------------------------------------------
116132

language/snippets/cloud-client/v1/README.rst.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ samples:
2828
show_help: true
2929

3030
cloud_client_library: true
31+
32+
folder: language/cloud-client/v1

language/snippets/cloud-client/v1beta2/README.rst

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
Google Cloud Natural Language API Python Samples
44
===============================================================================
55

6+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
7+
: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
8+
9+
610
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.
711

812
- See the `migration guide`_ for information about migrating to Python client library v0.26.1.
@@ -58,6 +62,10 @@ Samples
5862
Quickstart
5963
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6064

65+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
66+
: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
67+
68+
6169

6270

6371
To run this sample:
@@ -70,6 +78,10 @@ To run this sample:
7078
Snippets
7179
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7280

81+
.. image:: https://gstatic.com/cloudssh/images/open-btn.png
82+
: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
83+
84+
7385

7486

7587
To run this sample:
@@ -81,13 +93,13 @@ To run this sample:
8193
usage: snippets.py [-h]
8294
{classify-text,classify-file,sentiment-entities-text,sentiment-entities-file,sentiment-text,sentiment-file,entities-text,entities-file,syntax-text,syntax-file}
8395
...
84-
96+
8597
This application demonstrates how to perform basic operations with the
8698
Google Cloud Natural Language API
87-
99+
88100
For more information, the documentation at
89101
https://cloud.google.com/natural-language/docs.
90-
102+
91103
positional arguments:
92104
{classify-text,classify-file,sentiment-entities-text,sentiment-entities-file,sentiment-text,sentiment-file,entities-text,entities-file,syntax-text,syntax-file}
93105
classify-text Classifies content categories of the provided text.
@@ -107,13 +119,14 @@ To run this sample:
107119
syntax-text Detects syntax in the text.
108120
syntax-file Detects syntax in the file located in Google Cloud
109121
Storage.
110-
122+
111123
optional arguments:
112124
-h, --help show this help message and exit
113125
114126
115127
116128
129+
117130
The client library
118131
-------------------------------------------------------------------------------
119132

language/snippets/cloud-client/v1beta2/README.rst.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ samples:
2828
show_help: true
2929

3030
cloud_client_library: true
31+
32+
folder: language/cloud-client/v1beta2

language/snippets/movie_nl/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# Introduction
2+
3+
[![Open in Cloud Shell][shell_img]][shell_link]
4+
5+
[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png
6+
[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
27
This sample is an application of the Google Cloud Platform Natural Language API.
38
It uses the [imdb movie reviews data set](https://www.cs.cornell.edu/people/pabo/movie-review-data/)
49
from [Cornell University](http://www.cs.cornell.edu/) and performs sentiment & entity

0 commit comments

Comments
 (0)