Skip to content

Latest commit

 

History

History
 
 

nlp-sentiment-analysis

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Use Sentiment Analysis With Python to Classify Reviews

Resources and materials for Real Python's Use Sentiment Analysis With Python to Classify Reviews tutorial.

Installation

Create and activate a new virtual environment:

$ python -m venv .venv
$ source .venv/bin/activate

Install Python dependencies into the active virtual environment:

(.venv) $ python -m pip install -r requirements.txt

Download English model for spaCy:

(.venv) $ python -m spacy download en_core_web_sm

Download and extract the Large Movie Review Dataset compiled by Andrew Maas:

$ curl -s https://ai.stanford.edu/~amaas/data/sentiment/aclImdb_v1.tar.gz | tar xvz

Usage

Get the sentiment of a movie review stored in the TEST_REVIEW variable:

(.venv) $ python sentiment_analyzer.py