A simple Python chatbot that responds to predefined user inputs using rule-based logic and conditional statements.
This project demonstrates chatbot fundamentals without machine learning by using if-elif-else, loops, and basic input processing.
The chatbot accepts user input, matches predefined commands, and returns responses based on rules.
It supports:
- Greetings and conversations
- AI and Python-related questions
- Fun interactions
- Date and time responses
- Simple calculations
- Exit commands
- Rule-based chatbot implementation
- Continuous conversation using loops
- Input normalization using
lower() - Multiple response categories
- Beginner-friendly structure
- No external libraries required
Start
↓
Display Welcome Message
↓
Accept User Input
↓
Convert Input to Lowercase
↓
Match Rules (if-elif-else)
↓
Generate Response
↓
Continue / Exit
| Category | Examples |
|---|---|
| Greetings | hi, hello, hey |
| Introduction | who are you, what is your name |
| Conversation | how are you, thank you |
| Learning | what is python, what is ai |
| Fun | joke, motivate me |
| Date & Time | current date, current time |
| Math | add, multiply, square |
| Mood | i am happy, i am sad |
| Exit | exit, quit, bye |
| Component | Technology |
|---|---|
| Language | Python |
| Built-in Module | datetime |
| Logic | if-elif-else |
| Execution | while loop |
Rule-Based-AI-Chatbot/
│
├── chatbot.py
├── README.md
└── requirements.txt
Clone the repository:
git clone https://github.com/anmol396/Rule-Based-AI-Chatbot.gitMove into the folder:
cd Rule-Based-AI-ChatbotInstall dependencies (if required):
pip install -r requirements.txtRun the chatbot:
python chatbot.pyBot → Welcome! Type 'exit' anytime.
User → hi
Bot → Hello! Nice to meet you.
User → what is ai
Bot → AI stands for Artificial Intelligence.
User → bye
Bot → Goodbye! Have a nice day.
After completing this project:
- Build a console-based chatbot
- Work with conditions and loops
- Process user input
- Understand rule-based AI concepts
- Organize Python projects
- GUI using Tkinter
- Voice interaction
- NLP-based chatbot
- Web deployment
Developed as part of Project 1 – Rule-Based AI Chatbot