Skip to content

This Python program is helpful in analyzing movie reviews because it can automatically determine the sentiment of new comments and reviews.

Notifications You must be signed in to change notification settings

pamidev/sentiment-analyser

Repository files navigation

Sentiment Analyser

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.

Table of Contents

General Information

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.

Technologies Used

  • Python - version 3.11.3
  • from Python's standard library:
  • PyTest - version 7.3.1

Features

  • The user enters his film review and receives its general sentiment.

Screenshots

Example with positive comment:

Example screenshot with positive movie review

Example with negative comment:

Example screenshot with negative movie review

Setup

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

Usage

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

Room for improvement:

  • Improving words counts in reference data DONE!
  • Improving review sentiment analysis DONE!
  • Code refactoring DONE!

To do:

  • Using click package
  • Tests using PyTest DONE!

Acknowledgements

About

This Python program is helpful in analyzing movie reviews because it can automatically determine the sentiment of new comments and reviews.

Resources

Stars

Watchers

Forks

Languages