https://web-production-d57f7.up.railway.app/predict
# 🚨 Women Hate Speech Detection System (Bangla)
🔗 **Live Application:**
https://web-production-d57f7.up.railway.app/predict
---
## 📌 Project Overview
This project presents a Machine Learning-based system for detecting hate speech targeting women in Bangla text content.
The goal of this system is to assist in content moderation by identifying harmful language directed towards women in user-generated comments.
The system provides:
- Real-time text classification
- Probability-based decision output
- Configurable sensitivity threshold
- Public web interface deployment
- Railway cloud hosting
---
## 🎯 Problem Statement
Online platforms often contain abusive and misogynistic comments targeting women.
Due to the lack of large annotated Bangla datasets, building a robust hate speech detection model remains challenging.
This project explores traditional machine learning approaches under limited data constraints and evaluates their performance in a real-world deployment setting.
---
## 🧠 Modeling Approach
### 🔹 Data
- ~2000 manually labeled Bangla comments
- Binary Classification Setup:
0 → Not Women Hate 1 → Women Hate
### 🔹 Feature Engineering
- TF-IDF Vectorization
- Word n-grams (1–2)
- Max Features: 30,000
- Stopword-free raw Bangla tokens
### 🔹 Model
- Logistic Regression
- Class Weight Tuning
- Threshold Optimization
### 🔹 Threshold Strategy
To increase recall for minority class:
```python
THRESHOLD = 0.30
Lower threshold improves recall (captures more harmful comments), at the cost of precision.
| Metric | Approximate Value |
|---|---|
| Accuracy | ~70% |
| Women Hate Recall | ~0.66 |
| F1 Score | ~0.30–0.40 |
⚠ Due to limited labeled samples for the Women Hate class, performance is constrained by dataset size.
| Model | Performance | Notes |
|---|---|---|
| Linear SVC | ~62% Accuracy | Stable but low recall |
| Logistic Regression | Better recall | Threshold tunable |
| LSTM | Underperformed | Limited dataset |
| Transformer (XLM-R) | Unstable | Data insufficient |
Conclusion:
Traditional ML models performed more reliably under limited data constraints.
User Input
↓
TF-IDF Vectorizer
↓
Logistic Regression Classifier
↓
Probability Score
↓
Threshold Decision
↓
Safe / Harmful Output
- Backend: FastAPI
- Model Serialization: Joblib (.pkl)
- Frontend: Tailwind CSS
- Hosting: Railway
- API Serving: Uvicorn
women-hate-app/
│
├── main.py
├── women_hate_model.pkl
├── requirements.txt
├── Procfile
│
└── templates/
└── index.html
git clone <your-repo-url>
cd women-hate-app
pip install -r requirements.txt
uvicorn main:app --reloadAccess locally at:
http://127.0.0.1:8000
- Push repository to GitHub
- Create Railway project
- Deploy from GitHub
- Ensure Procfile exists
- Auto-deployment enabled
Endpoint:
POST /predict
Returns:
{
"probability": 0.67,
"women_hate": 1
}- Increase labeled dataset (≥500 Women Hate samples)
- Incorporate multilingual transformer models
- Add YouTube bulk comment analysis
- Build moderation dashboard
- Implement role-based access
- Add monitoring and logging
- Deploy scalable version with Docker
- Limited labeled Bangla dataset
- Class imbalance issue
- Semantic nuance detection limited in traditional ML
- May produce false positives or false negatives
This system should assist moderation, not replace human review.
MD Ahadul Haque Suvo Machine Learning & NLP Project Bangladesh
This project is developed for research and educational purposes.