--- title: AI Ticket Classifier emoji: 🧠 colorFrom: indigo colorTo: purple sdk: streamlit sdk_version: 1.41.1 app_file: app.py pinned: false --- # 🧠 AI Ticket Classifier An AI-powered support ticket classification system that groups tickets by intent and generates automated responses using NLP techniques. --- ## 📌 Problem Statement Organizations receive hundreds of support tickets daily. Manually categorizing and routing each ticket is slow and error-prone. This system uses **TF-IDF**, **Cosine Similarity**, and **Keyword Matching** to instantly classify, group, and respond to tickets. ## 📋 Sample Tickets | # | Ticket | Classified As | |---|--------|---------------| | 1 | "I forgot my password, how to reset it?" | 🔐 Password / Authentication | | 2 | "I can't log in, as password is incorrect" | 🔐 Password / Authentication | | 3 | "How to see leave balance?" | 📊 HR / Leave Management | **Result:** Tickets 1 & 2 → grouped together (password-related), Ticket 3 → separate group (HR-related). --- ## 🛠️ Technologies Used | Technology | Purpose | |------------|---------| | Python 3 | Core language | | Streamlit | Interactive web UI | | scikit-learn | TF-IDF vectorization, cosine similarity | | pandas / numpy | Data handling | --- ## 📂 File Structure ``` AI Design/ ├── ticket_classifier.py → Main Streamlit app (NLP engine + UI) ├── requirements.txt → Python dependencies ├── REPORT.md → Detailed project report └── README.md → This file ``` --- ## 🚀 How to Run ### Prerequisites - Python 3.8 or later — [Download](https://python.org) ### Steps ```bash # 1. Navigate to the project folder cd "c:\Users\sakthi\Documents\AI Design" # 2. Install dependencies pip install -r requirements.txt # 3. Run the app streamlit run ticket_classifier.py # 4. Browser opens automatically at http://localhost:8501 ``` --- ## ⚙️ How It Works ``` User enters ticket │ ▼ Text Preprocessing (lowercase, remove punctuation, stop words) │ ▼ Keyword Matching (compare against category keyword lists) │ ▼ Scoring & Classification (highest score → category + confidence) │ ▼ Display Result (category badge, confidence bar, auto-response) │ ▼ Grouping (add to category group, update similarity matrix) ``` ### NLP Techniques - **Tokenization** — splits text into individual words - **Stop Word Removal** — removes common words (a, the, is, are) - **TF-IDF** — scores words by importance (frequent in one ticket, rare across all) - **Cosine Similarity** — measures how similar two tickets are (0 = different, 1 = identical) - **Keyword Matching** — matches ticket text against predefined category keywords --- ## 📊 Supported Categories | Category | Example Keywords | |----------|-----------------| | 🔐 Password / Auth | password, reset, forgot, login, credentials | | 📊 HR / Leave | leave, balance, salary, work from home, payroll | | 💻 IT / Hardware | laptop, slow, crash, printer, software | | 🌐 Network | vpn, wifi, internet, connection, firewall | | 🔑 Access / Permissions | access, permission, shared drive, repository | | ❓ General | (fallback for unmatched tickets) | --- ## 📈 Features - ✅ Instant ticket classification with confidence scores - ✅ Automated responses from knowledge base - ✅ Visual ticket grouping by category - ✅ Interactive similarity matrix heatmap - ✅ 3 pre-loaded example tickets - ✅ Premium dark-mode UI - ✅ No external API or cloud services needed