This project is an AI-powered Natural Language Processing (NLP) system designed to automate the classification and prioritization of citizen complaints. The system analyzes raw text grievances, categorizes them into relevant government departments, and assigns urgency using sentiment analysis.
- 🔍 Department Classification (Multi-class NLP model)
- 💬 Sentiment Analysis (Neutral / Negative / Critical)
- ⚡ Priority Scoring System
- 🧠 Dual-Model Architecture
- 🌐 FastAPI Deployment for Real-Time Predictions
- 📊 EDA & Data Pipeline
Raw Complaint Text ↓ Text Preprocessing ↓ Department Model (SVM + TF-IDF) ↓ Sentiment Model (SVM + TF-IDF) ↓ Priority Mapping ↓ Final Output (JSON Response)
| Model | Accuracy |
|---|---|
| Department Classification | ~81% |
| Sentiment Analysis | ~98% |
- Cross-validation used to ensure generalization
- Macro F1-score optimized for balanced performance
- Python
- Scikit-learn
- FastAPI
- Pandas / NumPy
- spaCy (Lemmatization)
- Matplotlib / Seaborn (EDA)
citizen-grievance-ai/
│
├── api/
│ └── main_gen.py
│
├── models/
│ ├── department_svm_model_gen.pkl
│ ├── tfidf_vectorizer_svm_gen.pkl
│ ├── sentiment_model_gen.pkl
│ ├── tfidf_vectorizer_sentiment_gen.pkl
│
├── src/
│ ├── models/
│ ├── preprocessing/
│ ├── eda/
│
├── data/
│ └── generated/
git clone https://github.com/PatsyJaneJocelin/AI_Driven_CitizenGrievanceSystem.git
cd citizen-grievance-ai
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
uvicorn api.main_gen:app --reload
Open in browser:
http://127.0.0.1:8000/docs
{
"text": "Garbage not collected for 3 days, very bad situation"
}{
"department": "Municipal Services",
"sentiment": "Negative",
"priority": 3
}- Built a dual-output NLP pipeline
- Implemented task-specific feature engineering
- Used cross-validation to prevent overfitting
- Designed a real-world noisy dataset (50,000 samples)
- Deployed using FastAPI for real-time inference
- Transformer-based models (BERT / RoBERTa)
- Multilingual support enhancement
- Frontend dashboard (React)
- Cloud deployment (AWS / Render)
This project demonstrates how AI can be leveraged to improve public sector efficiency by automating complaint categorization and prioritization, enabling faster and more transparent grievance redressal.