Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

181 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.


📊 Model Performance

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 Comparison

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.


🏗 System Architecture

User Input
     ↓
TF-IDF Vectorizer
     ↓
Logistic Regression Classifier
     ↓
Probability Score
     ↓
Threshold Decision
     ↓
Safe / Harmful Output

🌐 Deployment Architecture

  • Backend: FastAPI
  • Model Serialization: Joblib (.pkl)
  • Frontend: Tailwind CSS
  • Hosting: Railway
  • API Serving: Uvicorn

📂 Project Structure

women-hate-app/
│
├── main.py
├── women_hate_model.pkl
├── requirements.txt
├── Procfile
│
└── templates/
      └── index.html

⚙️ Local Installation

git clone <your-repo-url>
cd women-hate-app

pip install -r requirements.txt
uvicorn main:app --reload

Access locally at:

http://127.0.0.1:8000

🚀 Deployment (Railway)

  1. Push repository to GitHub
  2. Create Railway project
  3. Deploy from GitHub
  4. Ensure Procfile exists
  5. Auto-deployment enabled

🔐 API Example

Endpoint:

POST /predict

Returns:

{
  "probability": 0.67,
  "women_hate": 1
}

📈 Future Improvements

  • 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

⚠ Limitations

  • 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.


👨‍💻 Author

MD Ahadul Haque Suvo Machine Learning & NLP Project Bangladesh


📜 License

This project is developed for research and educational purposes.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages