This Python program is helpful in analyzing movie reviews because it can automatically determine the sentiment of new comments and reviews based on its database of 42 928 short movie reviews previously rated as positive and negative.
- General Info
- Technologies Used
- Features
- Screenshots
- Setup
- Usage
- Room for Improvement
- Acknowledgements
The purpose of the program is to use a glob module from standard Python's library and to analyze a dataset of movie reviews. The training reference data consists of 21 467 positive and 21 461 negative film reviews.
The program compute how many positive reviews and how many negative reviews from the database each word of the user's review appears in and finally calculates the total user's review sentiment.
Thanks to this project, I learned how to use Python programing language and its packages to analyze data.
- The user enters his film review and receives its general sentiment.
Example with positive comment:
Example with negative comment:
I assume You know how to cloning this repository. If not, I refer you to this publication.
Python version should not matter here, although the program was written and tested on version 3.11.3. There is no need to install anything extra, except PyTest package for testing.
If You don't have any Python version, download and install from here.
You can check your Python version by typing in terminal:
$ python --version
But if You want to test my program, You need to create and activate virtual environment like this:
$ python -m venv .venv
$ cd .venv\Scripts
$ activate
$ cd ..
$ cd ..
and install pytest package with dependencies in the previously created virtual environment:
$ pip install -r tests_requirements.txt
or
$ pip install -U pytest
How does one go about using it? It's simple. :-) Type in terminal:
$ python sentiment_analyser.py
or for testing (check Setup first):
$ pytest tests_password_generator.py
Room for improvement:
Improving words counts in reference dataDONE!Improving review sentiment analysisDONE!Code refactoringDONE!
To do:
- Using click package
Tests using PyTestDONE!
- This program was inspired by one of exercises of the Practical Python educational program.
- Many thanks to Krzysztof Mędrela.