| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
This sample contains the code referenced in the Sentiment Analysis Tutorial within the Google Cloud Natural Language API Documentation. A full walkthrough of this sample is located within the documentation.
This sample is a simple illustration of how to construct a sentiment analysis request and process a response using the API.
Set up your Cloud Natural Language API project , which includes:
$ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git $ cd python-docs-samples/language/sentiment
Open a sample folder, create a virtualenv, install dependencies, and run the sample:
$ virtualenv env $ source env/bin/activate (env)$ pip install -r requirements.txt
This sample provides four sample movie reviews which you can provide to the sample on the command line. (You can also pass your own text files.)
(env)$ python sentiment_analysis.py textfile.txt Sentiment: score of -0.1 with magnitude of 6.7
| Back | FazBrowse Home | New Git URL |