0% found this document useful (0 votes)
10 views12 pages

Nitheesh

Uploaded by

nitheeshstudies
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views12 pages

Nitheesh

Uploaded by

nitheeshstudies
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

ST.

JOHN’S ENGLISH SCHOOL &


JUNIOR COLLEGE

COMPUTER SCIENCE
PROJECT 2024-25
AI CHATBOT USING PYTHON

DONE BY
NITHEESH H (12120)

XII A
ACKNOWLEDGEMENT
I would like to thank the almighty whose blessings enlightened me
to accomplish my project successfully. His might gave me courage,
patience, good concentration and strength through my endeavor.

I am proud and privileged to express my sincere thanks and praise


Mrs. Anitha Edison, Senior Principal, Mrs. Anitha Rajkumar, Principal,
Mrs.Sheela, Vice Principal and all supervisory heads for their consent and
had shared the fruit of my knowledge by constant guidance and support. I
am heartly thankful to my computer science teacher and project guide
Mrs. Praveena Juliet whose encouragement, guidance and support from
the initial to the final level enabled me to develop an understanding of the
subject.
ABSTRACT
This project focuses on building a simple AI chatbot using Python,
designed to hold basic conversations with users and provide helpfulresponses.
The chatbot uses fundamental programming techniquesto recognize keywords
and respond to common questions, without requiring advanced artificial
intelligence or machine learning.

Using Python’s Natural Language Toolkit (NLTK) and straightforward


conditionals, the chatbot can understand basic input and offer relevant replies. For
example, if a user says "hello," the chatbot will respond with a greeting, or if the
user asks for help, it can provide general advice. This approach keeps the chatbot
easy to code andunderstand, making it ideal for beginners in AI and programming.

The project introduces students to essential concepts in chatbot development,


like recognizing intent (what the user wants) and generating responses based on
keywords. By working with Python, students can see how simple code can create
interactive experiencesand explore the basics of natural language processing.
This chatbotproject is a practical, hands-on way for students to start learning about
AI while practicing coding skills in Python.
HARDWARE

DESTOP COMPUTER / LAPTOP


MOBILE PHONE

SOFTWARE

PYTHON (LATEST VERSION)


MY SQL
PYTHON CONNCETOR MODULE
PROPOSED SYSTEM
The proposed system is a simple AI chatbot built using Python, designed to
introduce students to the basics of artificial intelligenceand natural language
processing (NLP). This chatbot system is intended to be user-friendly, easy to
understand and practical for beginners, allowing students to interact with it
through straightforward text-based conversations.

System Overview:

 Natural Language Processing (NLP) with Basic PythonLibraries: The


chatbot uses Python’s NLTK (Natural Language Toolkit) to process user
input, identify keywords, and understand simple phrases. Through NLP,
the system can break down user messages into recognizable patterns,
allowing it to respond appropriately to greetings, common questions, and
requests for information.

 Keyword Matching and Rule-Based Logic: Rather than relying on complex


machine learning models, this chatbot uses keyword matching to
determine responses. For example, if a user types "hello," the chatbot will
recognize it as a greeting and respond accordingly. This rule-based approach
makes it easy to program responses to specific keywords or phrases and
allows students to understand how Chatbot’s can operate without
advanced AI techniques.
ABOUT PYTHON
Python is a widely used, high-level programming language known
for its simplicity and readability, making it a popular choice for
beginners and experts alike. Created by Guido van Rossum in 1991,
Python’sclean, easy-to-understand syntax allows developers towrite
clear and concise code, focusing more on problem-solving than complex
syntax.

As an interpreted and dynamically typed language, Python executes


code line-by-line and doesn’t requireexplicit type declarations, enabling
quick developmentand debugging. Python supports multiple
programming paradigms, including object-oriented, procedural, and
functional programming, allowing flexibility in coding style.

Python’s extensive library support is one of its strongest features. Its


standard library offers modulesfor common programming tasks, while
third-party libraries extend Python’s capabilities into specializedareas
like data science, machine learning, web development, and automation.
Popular libraries like Pandas and NumPy facilitate data analysis, while
Django and Flask simplify web development.

Python is also cross-platform, running on Windows, macOS, and


Linux with minimal changes, making it versatile and widely compatible.
The language's open-source nature has fostered a large, active
community that provides abundant resources, support, and continuous
updates, making Python both powerful and accessible.

Python’s applications are diverse, from web development and data


science to automation and scientific research, making it a valuable
language for almost any programming field. Its adaptability, ease ofuse,
and strong community support make Python a staple in programming
and an essential tool for modern development.
ABOUT MYSQL

MySQL is an open-source relational database management system


(RDBMS) widely used for storing, organizing, and retrieving data
efficiently.
Developed in the mid-1990s and now owned by OracleCorporation,
MySQL is known for its speed, reliability,and ease of use, making it one
of the most popular database systems worldwide.

Key features of MySQL include cross-platform support, scalability


for high-demand environments, robust security measures like user
authentication andencryption, and high availability options such as
replication and clustering. Its open-source nature fosters a large
community of developers who contribute to its growth and provide
extensive documentation and tools.

Overall, MySQL is a powerful and flexible databasesolution that


effectively manages and queries data.
MODULES AND SUBMODULES USED IN PROGRAM
AND ITS REPRESENTATION

Modules:
random
 Used for generating random choices from a list ofresponses.

re (Regular Expressions)
 Used for pattern matching to identify greetings andfarewells in the user
input.

Sub-modules:
random.choice()

 Used to select a random response from the greetings_responses and


farewell_responseslists.

re.search()

 Used to search for specific patterns (e.g., greetingslike "hello" or "hi"


and farewells like "bye" or "goodbye") in the user input
SOURCE CODE
1 import random
2 import re

3
4 # Basic responses for greeting and farewell
5 greetings_responses = ["Hello! How can I help youtoday?",
"Hi there! What would you like to know?", "Hey! How's it
going?"]
6 farewell_responses = ["Goodbye!", "Take care!","See
you later!"]
7
8 # Function to process user input and respond
accordingly
9 def chatbot_response(user_input):
10 user_input = user_input.lower()11
12 # Greeting intent
13 if re.search(r"(hello|hi|hey)", user_input):
14 return random.choice(greetings_responses)

15
16 # Farewell intent
17 elif re.search(r"(bye|goodbye)", user_input):
18 return random.choice(farewell_responses)

19
20 # Default response
21 else:
22 return "I'm sorry, I didn't understand that. Canyou please
ask in a different way?"
23
24 # Chatbot conversation loop
25 print("Chatbot: Hello! I'm a simple chatbot. Type'bye' to
exit.")
26 while True:
27 user_input = input("You: ")

28
29 # If the user types 'bye', exit the conversation
30 if "bye" in user_input.lower():
31 print("Chatbot: "+ random.choice(farewell_responses))
32 break
33 else:
34 response = chatbot_response(user_input)
35 print("Chatbot: " + response)
OUTPUT
BIBILOGRAPHY

 Computer Science with Python(Sumita Arora)


 MySQL. Wikipedia, Wikimedia Foundation,
https://en.wikipedia.org/wiki/MySQL.
Overview of MySQL, its features, and uses.
 MySQL Documentation. Oracle, https://dev.mysql.com/doc/.
Official documentation for MySQL.
 Shah, Sayed Zia, and Imran Ahmad. MySQL Essentials. Packt
Publishing, 2018.
A beginner-friendly book on MySQL basics.
 Oracle Corporation. "MySQL Overview." Oracle,
https://www.oracle.com/database/mysql/.
Overview of MySQL features from Oracle.

You might also like