🚀 Chatbot Intent Classifier is a deep learning-based chatbot designed to understand user intent using Natural Language Processing (NLP). It leverages word embeddings, sentence similarity, and neural networks to classify user inputs into predefined categories and generate accurate responses.
✅ Intent classification using deep learning
✅ Word embeddings with SentenceTransformers
for better context understanding
✅ Customizable intents via intents.json
✅ Pretrained model for quick deployment
✅ Real-time interaction through a command-line interface
📦 chatbot-intent-classifier
┣ 📜 chatbot.py # Main chatbot script
┣ 📜 chatbot_model_intents.py # Model training script
┣ 📜 intents.json # Intent dataset (customizable)
┣ 📜 chatbot_model.keras # Trained deep learning model
┣ 📜 words.pkl / classes.pkl # Preprocessed data
┗ 📜 README.md # This file
git clone https://github.com/yourusername/chatbot-intent-classifier.git
cd chatbot-intent-classifier
Make sure you have Python 3.8+ installed. Then, run:
pip install -r requirements.txt
If you want to retrain the model with new intents, run:
python chatbot_model_intents.py
python chatbot.py
💬 The chatbot will start and you can begin chatting in the terminal!
1️⃣ Text Processing: The input text is tokenized and lemmatized.
2️⃣ Intent Prediction: Using SentenceTransformers, the chatbot calculates the similarity of user input with predefined patterns.
3️⃣ Neural Network: A deep learning model trained with Keras
predicts the most likely intent.
4️⃣ Response Generation: A random response is selected from the predefined responses in intents.json
.
The chatbot model is built using a feedforward neural network with multiple layers:
- Input Layer: Vectorized text input
- Hidden Layers: Fully connected layers with
ReLU
activation and dropout - Output Layer: Softmax classifier for intent prediction
- Optimizer: Adam (
learning_rate=0.001
) - Loss Function: Categorical Cross-Entropy
- Epochs: 300
- Batch Size: 16
You can add or modify intents in the intents.json
file. Example format:
{
"intents": [
{
"tag": "greeting",
"patterns": ["Hello", "Hi there", "Hey!"],
"responses": ["Hello!", "Hi, how can I help?", "Hey there!"],
"keywords": ["hello", "hi", "hey"]
}
]
}
✨ Implement Transformer-based models for better intent detection
✨ Add speech-to-text integration for voice input
✨ Deploy as a web service using Flask or FastAPI
Contributions are welcome! Feel free to fork this repo and submit a pull request.
💡 Developed by Planisphere.
📌 Follow me on GitHub for more projects! 🚀