GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - MRohaabBaig/Task01-Muhammad-Ruhaab-Baig

BranchesTags
Open more actions menu

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
README.md
README.md
 
 
Rule_Based_AI_Chatbot.py
Rule_Based_AI_Chatbot.py
 
 

Repository files navigation

Rule-Based AI Chatbot

A simple Rule-Based AI Chatbot built in Python as Project 1 of my Artificial Intelligence internship at DecodeLabs.

This project introduces the basic concepts of Artificial Intelligence through predefined rules, decision-making, control flow, and continuous user interaction. Instead of using machine learning, the chatbot responds according to predefined inputs and responses.

Project Overview

The goal of this project is to create a simple chatbot that can:

  • Respond to predefined user inputs
  • Handle common greetings
  • Answer basic questions
  • Provide a help message
  • Recognize exit commands
  • Continue chatting until the user chooses to exit

The project focuses on building a strong foundation in programming logic and basic AI concepts before moving toward more advanced AI systems.

How It Works

The chatbot uses a dictionary called responses to store predefined user inputs and their corresponding responses.

For example:

  • hello → Hi there! How can I help you today?
  • hi → Hello! What can I do for you?
  • how are you → A predefined response
  • what is your name → Information about the chatbot
  • help → Available commands
  • thanks / thank you → A polite response

When the user enters a message, the program:

  1. Takes the user's input.
  2. Converts it to lowercase.
  3. Removes unnecessary spaces.
  4. Checks whether it is an exit command.
  5. Searches for a matching response.
  6. Displays the chatbot's response.
  7. Continues running until the user exits.

The project uses a continuous while loop to maintain the conversation.

Features

  • Predefined Responses — Responds to known inputs stored in a Python dictionary.
  • Input Cleaning — Uses .lower() and .strip() so capitalization and extra spaces do not affect matching.
  • Exit Commands — Supports exit, bye, and quit.
  • Fallback Response — Gives a helpful message when the chatbot does not recognize the input.
  • Continuous Conversation — Runs inside a while True loop until the user exits.
  • Simple Structure — Functions are used to keep the code organized and easy to understand.

Technologies Used

  • Python 3
  • Python Dictionaries
  • Functions
  • if statements
  • while loops
  • String methods
  • Basic control flow and decision-making

Project Structure

Rule-Based-AI-Chatbot/
│
├── Rule_Based_AI_Chatbot.py
└── README.md

How to Run

  1. Clone the repository
git clone <https://github.com/MRohaabBaig/Rule_Based_AI_Chatbot---Project-1.git>
  1. Open the project folder
cd Rule-Based-AI-Chatbot
  1. Run the Python file
python Rule_Based_AI_Chatbot.py

Example Interaction

----------Rule Based AI Chatbot----------

Chatbot is running. Type 'help' for options or 'exit' to quit.

You: hello
Bot: Hi there! How can I help you today?

You: what is your name
Bot: I'm a simple rule-based chatbot, built for Project 1.

You: help
Bot: You can say hello, ask how I am, ask my name, or type 'exit' to quit.

You: bye
Bot: Goodbye!

Important Code Concepts

Response Dictionary

The chatbot stores its predefined responses in a dictionary. This makes it easy to add or modify responses without changing the main conversation logic.

Input Sanitization

The user's input is cleaned using:

clean_input = input_text.lower().strip()

This allows inputs such as Hello, HELLO, and hello to be handled consistently.

Exit Handling

The chatbot checks the user's input against predefined exit commands:

EXIT_COMMANDS = {"exit", "bye", "quit"}

When one of these commands is entered, the conversation ends.

Fallback Response

If the user's input does not exist in the response dictionary, the chatbot provides a default response instead of stopping or producing an error.

Learning Objectives

Through this project, I practiced:

  • Python dictionaries
  • Functions
  • Conditional logic
  • Loops
  • User input handling
  • String manipulation
  • Program flow and decision-making
  • The basic concept of rule-based AI

Future Improvements

This project can be expanded by:

  • Adding more user inputs and responses
  • Supporting multiple variations of the same question
  • Adding more conversational intents
  • Using nested conditions for more advanced responses
  • Giving the chatbot a unique personality
  • Improving its understanding of different user inputs

These types of extensions are also encouraged in the project brief as ways to experiment and build beyond the basic implementation.

Internship Project

Project: Project 1 — Rule-Based AI Chatbot Program: Artificial Intelligence Internship Organization: DecodeLabs Language: Python

This project is my first internship project, focused on understanding the fundamental building blocks of AI through hands-on programming and logical decision-making.

If you find this project useful, feel free to explore the repository and follow my journey as I continue learning Artificial Intelligence, Automation, and modern technologies.

About

No description, website, or topics provided.

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.