Skip to content

anmol396/Rule-Based-AI-Chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Rule-Based-AI-Chatbot

Python

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.


Project Overview

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

Features

  • Rule-based chatbot implementation
  • Continuous conversation using loops
  • Input normalization using lower()
  • Multiple response categories
  • Beginner-friendly structure
  • No external libraries required

Chatbot Workflow

Start
 ↓
Display Welcome Message
 ↓
Accept User Input
 ↓
Convert Input to Lowercase
 ↓
Match Rules (if-elif-else)
 ↓
Generate Response
 ↓
Continue / Exit

Supported Commands

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

Tech Stack

Component Technology
Language Python
Built-in Module datetime
Logic if-elif-else
Execution while loop

Project Structure

Rule-Based-AI-Chatbot/
│
├── chatbot.py
├── README.md
└── requirements.txt

Installation

Clone the repository:

git clone https://github.com/anmol396/Rule-Based-AI-Chatbot.git

Move into the folder:

cd Rule-Based-AI-Chatbot

Install dependencies (if required):

pip install -r requirements.txt

Run the chatbot:

python chatbot.py

Example Interaction

Bot → 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.

Learning Outcomes

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

Future Improvements

  • GUI using Tkinter
  • Voice interaction
  • NLP-based chatbot
  • Web deployment

Developed as part of Project 1 – Rule-Based AI Chatbot

About

A beginner-friendly Rule-Based AI Chatbot built using Python. The chatbot responds to predefined user inputs using if-elif-else logic, supports greetings, help commands, math operations, date/time queries, and exit commands. Includes continuous conversation loop, input normalization, question counter, and interactive chatbot experience.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages