Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

55 Commits

Folders and files

Repository files navigation

NLP Text Classification Pipeline

Python 3.10+ PyTorch Streamlit Flask License: MIT

An end-to-end Machine Learning architecture for text classification, transitioning from classical Natural Language Processing to modern Transformer-based deep learning.

Explore the Code · Dataset Info · Deployment


Overview

This project serves as a comprehensive, production-ready pipeline for classifying SMS messages and emails as Spam or Ham (Safe). It is designed to be highly modular, functioning both as a robust classification tool and an educational progression from standard statistical models (Bag of Words) to state-of-the-art Deep Learning (HuggingFace Transformers).

Key Features:

  • Progressive Complexity: 7 distinct Jupyter notebooks structured as a learning curriculum.
  • Modular Source Code: Production-ready src/ directory for text cleaning, feature extraction, and inference.
  • Dual Deployment: Features both a Streamlit dashboard for rapid prototyping and a Flask application for traditional web deployment.
  • Automated Testing: Integrated unit testing suite using pytest.


(Demo: Streamlit Interface running local inference via Naive Bayes)


Project Architecture

Click to collapse/expand the directory tree
nlp-spam-classifier/
├── app/
│   ├── app.py                 # Streamlit interactive application
│   ├── flask_app.py           # Flask web server
│   └── templates/
│       └── index.html         # Tailwind CSS frontend for Flask
├── data/
│   ├── raw/                   # Immutable raw UCI dataset (spam.tsv)
│   ├── processed/             # Ephemeral cleaned data (.csv)
│   └── README.md              # Data dictionary and schema rules
├── models/                    # Serialized .pkl models and vectorizers (Git-ignored)
├── notebooks/
│   ├── 01_eda.ipynb           # Exploratory Data Analysis
│   ├── 02_preprocessing.ipynb # Text Normalization Pipeline
│   ├── 03_baseline_model.ipynb# Naive Bayes + BoW
│   ├── 04_tfidf_model.ipynb   # TF-IDF + SVM/Logistic Regression
│   ├── 05_word_embeddings.ipynb # Word2Vec semantic mapping
│   ├── 06_transformer_model.ipynb # DistilBERT fine-tuning
│   └── 07_error_analysis.ipynb# False positive/negative evaluation
├── src/
│   ├── __init__.py
│   ├── preprocessing.py       # Reusable cleaning & lemmatization logic
│   ├── features.py            # Vectorization wrappers
│   ├── train.py               # Model training execution
│   ├── evaluate.py            # Core metrics and confusion matrices
│   └── predict.py             # Live inference engine for web apps
├── tests/
│   └── test_preprocessing.py  # Pytest suite for data integrity
├── config.yaml                # Global variables and hyperparameters
├── environment.yml            # Conda environment build file
├── requirements.txt           # Pip dependencies fallback
└── README.md

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages