sentiment-analysis
To get the project from GitHub:
git clone https://github.com/ali-771/sentiment-analysis.git
cd sentiment-analysisThen install dependencies using uv and setup the environment:
uv install(Assumes pyproject.toml includes all dependencies like transformers, pyserial, sklearn, etc.)
# Sentiment Analysis Project
This project implements a **Sentiment Analysis System** using Hugging Face Transformers (DistilBERT).
The model is fine-tuned on a prepared dataset and can be used both for **direct text predictions** and for **integration with ESP32** to receive messages and classify them in real-time.
---
## 📂 Project Structure
New_folder/ ├─ src/ │ ├─ data/ │ │ ├─ raw/ # raw dataset │ │ ├─ processed/ # cleaned dataset │ │ └─ clean_null.py # preprocessing script │ └─ models/ │ ├─ train_model.py # training script │ ├─ esp32.py # ESP32 bridge (serial communication) │ ├─ model_last2/ # trained model │ └─ compact_sentiment_predict.py ├─ main.py # main entry point for CLI predictions ├─ pyproject.toml # project dependencies (managed by uv) └─ uv.lock
---
## 📥 Download / Clone from GitHub
```bash
git clone https://github.com/ali-771/sentiment-analysis.git
cd sentiment-analysis
uv run python src/data/clean_null.py- Loads the raw dataset (
sentiment_synthetic.csv). - Removes null/empty rows.
- Saves the cleaned dataset as
sentiment_synthetic_final.csv.
uv run python src/models/train_model.py- Fine-tunes DistilBERT on the processed dataset.
- Saves the trained model into
src/models/model_last2/.
uv run python main.pyExample:
📝 Text: I love this
I love this --> positive
uv run python src/models/esp32.py- Opens a serial connection to ESP32 (default
COM10,115200 baud). - Reads messages from ESP32.
- Predicts sentiment using the trained model.
- Sends the prediction back to ESP32.
- Ali Al-Khaledi – 202270295
- Zaid Damag – 202170119