A complete machine learning pipeline that classifies customer support tickets by issue type and urgency level, and extracts critical entities like product names, complaint keywords, and dates β all accessible through a sleek Gradio web interface.
Customer support teams handle thousands of tickets daily. Manually classifying and extracting key information from these tickets is time-consuming and error-prone. This project automates:
-
π Ticket Classification: Predicts issue_type and urgency_level.
-
π§ Entity Extraction: Extracts key entities such as product names, complaint keywords, and dates.
-
π Gradio Interface: Allows end users to interactively classify tickets in a user-friendly UI.
-
Data Cleaning & Preprocessing (lowercasing, lemmatization, stopwords removal)
-
TF-IDF & Feature Engineering (ticket length, sentiment scores)
-
Multi-Task Classification using Logistic Regression, SVM, and Random Forest
-
Entity Extraction using rule-based NLP (product names, dates, complaint terms)
-
Saved Models for inference reuse
-
Gradio Frontend for real-time predictions
π¦ ai_based_complaint_classifier
βββ data/
β βββ ai_dev_assignment_tickets_complex_1000.xlsx
β βββ cleaned_tickets.xlsx
β
βββ models/
β βββ issue_type_model.pkl
β βββ urgency_level_model.pkl
β βββ tfidf_vectorizer.pkl
β βββ feature_scaler.pkl
β
βββ src/
β βββ data_preprocessing.py
β βββ feature_engineering.py
β βββ model_training.py
β βββ entity_extraction.py
β βββ predict_ticket.py
β
βββ app/
β βββ app.py
β
βββ .gitignore
βββ LICENSE
βββ requirements.txt
βββ README.mdgit clone https://github.com/yashdew3/AI_Based-Complaint-Classifier.git
cd ai_based_complaint_classifierpip install -r requirements.txtcd src
python app.py-
Multi-class Classification
-
issue_type: Logistic Regression, SVM, Random Forest (best one selected)
-
urgency_level: Trained similarly
-
-
Entity Extraction
- Regex + Keyword-based patterns for products, dates, and complaint terms
Input:
"I received the EcoBreeze AC and itβs broken. Also, I ordered on April 5th."
Output:
{
"issue_type": "Product Defect",
"urgency_level": "High",
"extracted_entities":
{
"products": ["EcoBreeze AC"],
"dates": ["April 5th"],
"complaint_keywords": ["broken"]
}
}-
pandas,numpy,nltk,scikit-learn,textblob -
gradiofor UI
-
Integrate deep learning models (e.g.,
BERT) -
Use Named Entity Recognition (NER) with spaCy or transformers
-
Support multilingual ticket classification
-
Database/APIbackend for enterprise usage
Contributions are welcome! Please open an issue or submit a PR for enhancements or fixes. Feel free to check the issues page (if you have one) or open a new issue to discuss changes. Pull requests are also appreciated.
- Built by Yash Dewangan
- Github: YashDewangan
- Email: yashdew06@gmail.com
- Linkedin: YashDewangan