This tool utilizes Google's Natural Language Processing API to analyze the sentiment behind a piece of text.
Google's NLP library handles sentence tokenization already.
- Using a Gmail account, create a new Google Cloud Platform project
- Install the Cloud SDK for the operating system of your choice. This example runs on a Linux machine.
- Create a Service Account as described in the link and update the path to GOOGLE_APPLICATION_CREDENTIALS in
start.sh.example
with yours. - Create a virtualenv for this project e.g.
$ virtualenv name_of_my_env --python=python2
- Activate the virtualenv and install the project requirements via
$ source name_of_my_env && pip install -r requirements.txt
- Rename
start.sh.example
tostart.sh
, change permissions onstart.sh
to make it executable. e.g. on Linux
$ mv start.sh.example start.sh
$ chmod +x start.sh
- Launch the app from within the virtualenv by executing the following:
$ ./start.sh
- Enter a piece of text in the box shown and click the Get Sentiments button to see results OR
- Enter a twitter handle in the box provided and click Get Tweets and Sentiments button to see results
Form:
Sample Results:
- Add Unit Tests
- Add Mood Prediction based on the sentiments analyzed over a given time frame.