A simple desktop chatbot built using Natural Language Processing (NLP) and PyTorch.
This chatbot understands user input, predicts the intent using a neural network, and responds accordingly through a clean Tkinter GUI.
This project is an intent classification chatbot.
It works by:
- Converting user text into numerical format (Bag of Words)
- Passing it through a Neural Network
- Predicting the most likely intent
- Returning a predefined response
The goal of this project was to understand:
- How chatbots process text
- How machine learning models classify text
- How neural networks work in real applications
- How to connect ML models with a GUI
- Python 3
- PyTorch (Neural Network)
- NLTK (Tokenization & Stemming)
- Tkinter (GUI)
- NumPy
- Tokenization (splitting sentence into words)
- Lowercasing
- Stemming (reducing words to root form)
- Removing punctuation
Each sentence is converted into a numerical vector.
Example:
Input:
"Hello how are you?"
Converted into:
[0, 1, 0, 1, 0, ...]
This allows the neural network to understand text mathematically.
- Input Layer → Bag of Words size
- Hidden Layer 1 → ReLU
- Hidden Layer 2 → ReLU
- Output Layer → Number of intents
Loss Function: CrossEntropyLoss
Optimizer: Adam
The output layer gives probability scores for each intent.
The model:
- Predicts the highest probability intent
- If confidence > 75%, it returns a response
- Otherwise, it says it doesn’t understand
The chatbot runs inside a simple Tkinter desktop window.
Features:
- Clean student-level UI
- User & Bot message colors
- Send button + Enter key support
- Scrollable chat window
pip install torch nltk numpy
python train.py
python gui.py
SMART-AI-Chatbot/
│
├── train.py
├── gui.py
├── model.py
├── nltk_utils.py
├── intents.json
├── data.pth
└── README.md
- How text is converted into numbers
- How neural networks classify text
- Understanding of input size, hidden layers, and output layers
- Using PyTorch for training models
- Connecting ML models with a GUI
- Debugging real ML errors
- Add more intents
- Use advanced NLP models (like Transformers)
- Add memory/context support
- Improve GUI design
- Deploy as web application
This project was built as a learning exercise by referencing tutorials and understanding each component step-by-step.
The goal was not just to copy, but to understand how chatbot systems work internally.
Built as part of my Machine Learning & NLP learning journey.




