Skip to content

anmol396/Rule-Based-AI-Chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Rule-Based-AI-Chatbot

Objective

Build a beginner-friendly rule-based chatbot in Python that responds to predefined user inputs using only conditional logic.

Features

  • Uses only Python standard library features
  • Uses if-elif-else statements for chatbot decisions
  • Runs continuously with a while loop until the user exits
  • Converts user input with lower() for simple matching
  • Includes a fallback response for unsupported inputs
  • Supports greetings, introductions, study questions, fun replies, math, date, time, mood, personal questions, and exit commands
  • Prints a welcome message when the chatbot starts
  • Prints a goodbye message before exiting

Technologies Used

  • Python 3
  • Standard Library: datetime

Installation Steps

  1. Download or clone the project folder.
  2. Make sure Python 3 is installed on your computer.
  3. Open the project folder in a terminal or VS Code.

How to Run

Run the chatbot with:

python chatbot.py

Supported Commands

Greetings

  • hi
  • hello
  • hey

Introduction

  • what is your name
  • who are you
  • who made you

General Conversation

  • how are you
  • how is your day
  • thank you
  • good morning
  • good night

Help Commands

  • help
  • menu
  • commands

Study / Learning

  • what is python
  • what is ai
  • what is machine learning

Fun Responses

  • tell me a joke
  • tell me a fact
  • motivate me

Date & Time

  • what time is it
  • what is today's date

Basic Math

  • add
  • multiply
  • square

Mood Responses

  • i am happy
  • i am sad
  • i am bored

Personal Questions

  • do you like me
  • are you human
  • can you think

Exit Commands

  • bye
  • exit
  • quit

Example Output

Bot: Welcome! Type 'exit' anytime to leave.

User: hi
Bot: Hello! Nice to meet you.

User: what is your name
Bot: My name is RuleBot.

User: what is ai
Bot: AI stands for Artificial Intelligence.

User: help
Bot: Available commands:
- hi
- hello
- hey
...

User: bye
Bot: Goodbye! Have a nice day.

Folder Structure

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

Learning Outcomes

  • Using if-elif-else for decision making
  • Working with while loops
  • Handling user input in Python
  • Building a simple console application
  • Using basic functions to keep code organized

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