# Naija HateScan 🛡️
### Multilingual Hate Speech Detection System for Nigerian Social Media
> **HND Final Year Project** — Federal Polytechnic Offa, Department of Computer Science & Information Technology
---
## Overview
**Naija HateScan** is a web-based machine learning system that automatically classifies Nigerian social media posts as **Hate Speech**, **Offensive**, or **Neutral** content. It supports five language varieties:
| Language | Notes |
|---|---|
| English | Nigerian Standard English |
| Nigerian Pidgin | Nigerian Creole (code-mixed) |
| Yoruba | Southwest Nigeria |
| Hausa | Northern Nigeria |
| Igbo | Southeast Nigeria |
The classifier uses character-level TF-IDF n-gram features with Logistic Regression, making it effective even on code-mixed text where words switch between languages mid-sentence.
---
## Features
- **Single-text analysis** with AJAX (no page reload) and inline results
- **Batch analysis** — paste up to 100 posts or upload a CSV file
- **Severity scoring** — Mild / Moderate / Severe for each harmful post
- **Target detection** — Ethnic / Religious / Political / General targeting
- **Plain-language explanations** and flagged term highlighting
- **Analysis history** with filter, pagination, and per-record delete
- **Analytics dashboard** — Chart.js charts for trends, languages, severity
- **PDF export** via ReportLab for individual analysis reports
- **Auto language detection** with Nigerian variety bias
- **No user authentication** — single public-facing tool
---
## Tech Stack
| Layer | Technology |
|---|---|
| Backend | Python 3.10+, Flask 3.x |
| Database | SQLite via Flask-SQLAlchemy |
| ML | Scikit-learn (TF-IDF + Logistic Regression) |
| Language ID | langdetect + custom keyword voting |
| Frontend | Bootstrap 5.3, Chart.js 4, Font Awesome 6 |
| PDF | ReportLab 4.x |
| Model Persistence | joblib |
---
## Project Structure
```
naija_hatescan/
├── app.py # Flask app, routes, Analysis DB model
├── con …