Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sentiment Analysis System

A simple, clean NLP + Machine Learning project based on the provided SRS.

What this project does

The system classifies English reviews as Positive or Negative.

Pipeline:

IMDB dataset -> cleaning -> NLP preprocessing -> TF-IDF -> Logistic Regression + Linear SVM -> evaluation -> Streamlit prediction

The project intentionally avoids unnecessary complexity.

Models

  1. Logistic Regression - baseline model
  2. Linear SVM (LinearSVC) - improved model

The best model is selected using test F1-score.

Project structure

sentiment_analysis_project/
├── app.py
├── train.py
├── predict.py
├── evaluate.py
├── requirements.txt
├── README.md
├── data/
│   └── .gitkeep
└── models/
    └── .gitkeep

Setup

1. Create virtual environment

Windows:

python -m venv .venv
.venv\Scripts\activate

2. Install dependencies

pip install -r requirements.txt

3. Train the models

python train.py

The first run downloads the IMDB dataset through Hugging Face Datasets and saves a local CSV copy in data/.

The trained model is saved in models/.

4. Evaluate

python evaluate.py

5. Run the demo

streamlit run app.py

Workflow

Raw reviews
    ↓
Cleaning
    ↓
NLP preprocessing
    ↓
TF-IDF
    ↓
Logistic Regression + Linear SVM
    ↓
Compare metrics
    ↓
Save best model
    ↓
Streamlit prediction

Notes

  • IMDB is a labelled movie-review dataset.
  • The original train/test split is preserved.
  • The text cleaning is deliberately simple and readable.
  • No paid GPU is required.

About

AI-powered sentiment analysis application using NLP, TF-IDF and Machine Learning.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages