0% found this document useful (0 votes)
6 views21 pages

ChatBot Project Report in Python

Uploaded by

SURAJ MUJUMDAR
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)
6 views21 pages

ChatBot Project Report in Python

Uploaded by

SURAJ MUJUMDAR
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

A

PROJECT REPORT
ON

“ChatBot using Python”


SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE
AWARD OF

DIPLOMA IN COMPUTER ENGINEERING

SUBMITTED TO
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION,
MUMBAI

SUBMITTED BY

Name of Student Roll No

1]Auti Sakshi sandeep 12

GUIDED BY: (Khandekar.P.P)

SAMARTH POLYTECHNIC, BELHE


SAMARTH POLYTECHNIC, BELHE

CERTIFICATE
This is to certify that the project report entitled “ChatBot using Python”
Was successfully completed by Student of Sixth semester Diploma in
Computer engineering.

Name of Student :
1] Auti Sakshi Sandeep

In partial fulfillment of the requirements for the award of the Diploma in


Computer engineering and submitted to the Department of Computer of
Samarth Polytechnic, Belhe work carried out during a period for the academic
year 2024-25 as per curriculum .

[Link].P.P [Link] S.K. Prof. Kapile A.S.


(Subject Teacher) (H.O.D) (Principal)
ACKNOWLEDGMENT

This project is done as a semester project, as a part course titled


“ChatBot using Python”

I am really thankful to our course the Principal Prof. Kapile A.S. and the
HOD [Link].S.k Samarth Polytechnic, Belhe for his invaluable
guidance and assistance, without which the accomplishment of the task would
have never been possible.
I also thanks [Link].P.P or giving this opportunity to explore into the
real world and realize the interrelation without which a Project can never
progress. In this present project I have chosen the topic- “ChatBot using
Python”

I am also thankful to parents, friend and all staff of Computer engineering


department, for providing us relevant information and necessary clarifications,
and great support.

Name of Student:
1] Auti Sakshi Sandeep
INDEX
[Link] Title

1 Introduction

2 Source code

3 Outputs

4 Conclusion

5 References
Introduction
Chatbots are frequently used to assist in customer service to handle common inquiries,
answer FAQs, and provide 24/7 support. They can resolve issues quickly and end up
routing complex problems to human agents when necessary.
A chatbot can provide customers with multiple-choice questions, with each question
having its own image, text and/or video. By using these features, chatbots can ask
customers to choose a product category, which customers can select in one click.

Data used in program are:


• If Statement in Python:
If the simple code of block is to be performed if the condition holds true then the if
statement is used. Here the condition mentioned holds then the code of the block
runs otherwise not.
Syntax: if condition:
#statement to be executed if
# condition is true
• If else Statement in Python:
In conditional if Statement the additional block of code is merged as else statement
which is performed when if condition is false.
Syntax: if (condition): # Executes this block if # condition is trueelse: # Executes
this block if # condition is false

• Nested if Statement:
if statement can also be checked inside other if statement. This conditional statement
is called a nested if statement. This means that inner if condition will be checked
only if outer if condition is true and by this, we can see multiple conditions to be
satisfied.
Syntax: if (condition1): # Executes when condition1 is true if (condition2): #
Executes when condition2 is true # if Block is ending here# if Block is end here

• If-elif Statement in Python:


The if-elif statement is shortcut of if...else chain. While using if-elif statement at the
end else block is added which is performed if none of the above if-elif statement is
true.
Python if-elif Statement Syntax: -
Syntax: if (condition): statementelif (condition): statement...else: statement

• While Loop in Python:


In Python, a while loop is used to execute a block of statements repeatedly until a
given condition is satisfied. When the condition becomes false, the line immediately
after the loop in the program is executed.
While Loop Syntax: While expression:
Statement(s)
• Using else statement with While Loop in Python:
The else clause is only executed when your while condition becomes false. If you
break out of the loop, or if an exception is raised, it won’t be executed.

Syntax of While Loop with else statement:


While condition:
#execute the statement
else:
#execute the statement

• For Loop in Python:


For loops are used for sequential traversal. For
example: traversing a list or string or array etc. In Python, there is “for in”
loop which is similar to foreach loop in other languages. Let us learn how to use for
loop in Python for sequential traversals with examples.
For Loop Syntax:
For iterator_var in sequence:
Statement(s)
• Nested Loops:
Python programming language allows to use one loop inside another loop which is
called nested loop. Following section shows few examples to illustrate the concept.
Nested Loops Syntax:
For iterator_var in sequence:
For iterator_var in sequence:
Statement(s)
Statement(s)
• Python if-elif-else Ladder:
An if-elif-else ladder is an order of if statements connected by elif statements. This
enables you to check for numerous conditions and run separate code blocks based
on which condition is met.
Syntax: if condition1: # code block 1
elif condition2: # code block 2
elif condition3: # code block 3
else: # default code block
source code
import datetime import

random

# Define a function to handle user input and generate responses def

chatbot_response(user_input):

greetings = ["hello", "hiii", "hey", "hola", "howdy"] farewells = ["bye",

"goodbye", "see you later", "adios"] compliments = ["thank you", "thanks",

"awesome", "great", "amazing"] jokes = ["Why don't scientists trust atoms?

Because they make up everything!",

"I told my wife she was drawing her eyebrows too high. She looked surprised!",

"Parallel lines have so much in common. It’s a shame they’ll never meet!",

"I'm reading a book on anti-gravity. It's impossible to put down!",

"I used to play piano by ear, but now I use my hands."]

fun=["Thanks I'm a funny of ChatBot myself",

"Thanks Man!",

"Arigato!",

"Means alot thanks :)"] eats=["Yo' I'm a

ChatBot I'M A BOT!! Get it?",

"I'm a Goddamn Software",

"Please tell me this is a Joke",

"HaHaHa! Its a joke right?... Right?",

"Please for God's sake don't ask me this again!"]

songs = {"happy": "Pharrell Williams - Happy",

"sad": "Adele - Someone Like You",

"energetic": "Imagine Dragons - Thunder",

"relaxed": "Norah Jones - Don't Know Why",

"motivated": "Survivor - Eye of the Tiger"}


bollywood_movies = ["3 Idiots", "Dilwale Dulhania Le Jayenge", "Lagaan", "Sholay"]

hollywood_movies = ["The Godfather", "The Dark Knight", "Inception", "Forrest Gump"]

regional_movies = {"tollywood": ["Bahubali", "Arjun Reddy", "Ala Vaikunthapurramuloo",


"Maharshi"],

"kollywood": ["Mersal", "Viswasam", "Bigil", "Kaithi"],

"mollywood": ["Drishyam", "Premam", "Lucifer", "Bangalore Days"]}

facts = {"science": ["The shortest war in history was between Britain and Zanzibar on
August 27, 1896. Zanzibar surrendered after 38 minutes."],

"history": ["The Great Wall of China is over 13,000 miles long, and it was not built all
at once but rather over several centuries."],

"geography": ["Canada has the longest coastline of any country in the world,
measuring over 202,000 kilometers (125,500 miles)."],

"technology": ["The first computer virus was created in 1983 and was called the 'Elk
Cloner.'"],

"sports": ["Golf is the only sport to have been played on the moon. Alan Shepard hit
two golf balls on the moon during the Apollo 14 mission in 1971."]} study_tips = ["Take
regular breaks to avoid burnout.",

"Use mnemonic devices to help remember information.",

"Practice active recall by testing yourself on the material.",

"Teach the material to someone else to reinforce your own understanding.",

"Create a study schedule and stick to it to stay organized.",

"Did you tried meditation? If not then try it! Your focus will improve!"]

life_hacks = ["Use a paper clip to hold the end of a roll of tape.",

"Put a damp paper towel under a cutting board to keep it from slipping.",

"Rubbing a walnut on damaged wooden furniture can cover up dings and


scratches.",

"Put a dry towel in your dryer with wet clothes to dry them faster.",

"Use a hair straightener to quickly iron collars and cuffs."]

relationship_tips = ["Communicate openly and honestly with your partner.",

"Listen actively to your partner's concerns and feelings.",


"Express gratitude and appreciation for your partner regularly.",

"Make time for regular date nights to keep the romance alive.",

"Be willing to compromise and work through conflicts together."] gift_ideas =

["How about a personalized photo album filled with memories?",

"Consider giving a smartwatch to keep track of their fitness goals!",

"A gift card to their favorite restaurant or store is always a good option.",

"You could surprise them with a DIY craft kit to unleash their creativity!",

"For the music lover, a subscription to a music streaming service would be perfect.",

"Why not give them a cozy blanket and a selection of gourmet teas for a relaxing
evening?",

"A stylish planner or journal can help them stay organized and inspired.",

"Consider a cooking class experience where they can learn new culinary skills!",

"A set of succulents or indoor plants can brighten up their space and purify the air.",

"How about a board game or puzzle for some fun and quality time together?"]

game_recommendations = ["You should try playing 'The Witcher 3: Wild Hunt'. It's an epic
open-world RPG with immersive storytelling.",

"'Among Us' is a fun and social deduction game that you can play with
friends or online.",

"'Animal Crossing: New Horizons' offers a relaxing and charming experience


where you can build your own island paradise.",

"If you're a fan of puzzle games, check out 'Portal 2'. It features innovative
gameplay mechanics and a captivating storyline.",

"'Stardew Valley' is a delightful farming simulation game that's perfect for


unwinding and escaping into a peaceful virtual world.",

"'Overwatch' is a fast-paced team-based shooter with diverse characters and


exciting gameplay.",

"For a challenging and strategic experience, consider playing 'Dark Souls III'.
It's known for its intense difficulty and rewarding combat.",

"If you enjoy adventure games, give 'The Legend of Zelda: Breath of the
Wild' a try. It offers a vast and immersive world to explore.",
"'Rocket League' combines soccer with high-speed cars for a unique and
adrenaline-pumping gaming experience.",

"'Hollow Knight' is a beautifully crafted metroidvania game with tight


controls and atmospheric exploration."]

tv_series_recommendations = ["You should watch 'Breaking Bad'. It's a gripping crime


drama with intense storytelling.",

"'Stranger Things' is a nostalgic and thrilling series set in the 1980s, filled
with supernatural mysteries.",

"'Game of Thrones' offers epic fantasy storytelling with complex


characters and political intrigue.",

"If you're a fan of comedy, check out 'Friends'. It's a classic sitcom with
memorable characters and hilarious moments.",

"'The Crown' provides a fascinating glimpse into the British royal family
and historical events.",

"'Black Mirror' is a thought-provoking anthology series exploring the dark


side of technology and society.",

"For a lighthearted and feel-good series, give 'Brooklyn Nine-Nine' a try.


It's a hilarious comedy set in a police precinct.",

"'The Mandalorian' is a must-watch for Star Wars fans, featuring thrilling


adventures in a galaxy far, far away.",

"'Stranger Things' is a nostalgic and thrilling series set in the 1980s, filled
with supernatural mysteries.",

"'Breaking Bad' is a gripping crime drama that follows the transformation


of a high school chemistry teacher into a methamphetamine kingpin."]

recipie_recommendations=["Butter Chicken: \n Ingredients: Chicken (boneless) - 500g \n


Yogurt - 1/2 cup \n Ginger-garlic paste - 2 tbsp \n Butter - 50g \n Tomato puree - 1 cup \n Cream
- 1/2 cup \n Kasuri methi (dried fenugreek leaves) - 1 tsp \n Garam masala - 1 \n Red chili
powder - 1 tsp \n Salt - to taste \n Instructions: \n Marinate chicken with yogurt, ginger-garlic
paste, and salt. Keep it aside for 30 [Link] butter in a pan, add marinated chicken, and
cook until [Link] another pan, heat some butter, add tomato puree, garam masala, red chili
powder, and salt. Cook until oil [Link] cream and kasuri methi to the tomato [Link]
cooked chicken to the gravy and simmer for 5 minutes. Serve hot with naan or rice. ","Palak
Paneer:\nIngredients:Spinach (palak) - 500g \n Paneer (cottage cheese) - 200g\nOnion - 1,
chopped\nTomato - 2, chopped\nGinger-garlic paste - 1 tbsp\nGreen chili - 1, chopped\nCumin
seeds - 1 tsp\nGaram masala - 1 tsp\nTurmeric powder - 1/2 tsp\nCoriander powder - 1 tsp\nSalt
- to taste\nOil - 2 tbsp\nInstructions:\nBlanch spinach in boiling water for 2 minutes. Drain and
blend into a smooth paste.\nHeat oil in a pan, add cumin seeds, chopped onion, ginger-garlic
paste, and green chili. Saute until onions turn golden brown.\nAdd chopped tomatoes, turmeric
powder, coriander powder, garam masala, and salt. Cook until tomatoes are soft.\nAdd spinach
puree and cook for 5 minutes.\nCut paneer into cubes and add to the spinach gravy. Simmer for
2-3 minutes. Serve hot with roti or rice.\n"]

# For Greetings if

user_input.lower() in greetings:

return "Hello! How can I assist you today?"

# For Farewells elif

user_input.lower() in farewells:

return "Goodbye! Have a great day!"

# For Compliments elif

user_input.lower() in compliments:

return "You're welcome! I'm here to help."

# For Weather elif "weather" in user_input.lower(): return

"The weather is currently sunny with a temperature of 25°C.

# For Joke elif "joke" in

user_input.lower(): return

[Link](jokes) #For Joke

Compliments elif "funny" in

user_input.lower():

return [Link](fun)

#For food1 elif "What do you eat" in

user_input.lower():

return [Link](eats)

#For food2 elif "food" in

user_input.lower(): return

[Link](eats)
#For drink1 elif "What do you drink" in

user_input.lower():

return [Link](eats)

#For songs elif "recommend a song" in

user_input.lower():

mood = input("What mood are you in (happy/sad/energetic/relaxed/motivated)? ").lower()

if mood in songs:

return f"I recommend'{songs[mood]}'for your mood!"

else:

return "I'm sorry, I don't have a recommendation for that mood.

#For movies elif "recommend a movie" in

user_input.lower():

preference = input("Do you prefer Bollywood or Hollywood movies? ").lower()

if preference == "bollywood":

return f"I recommend '{[Link](bollywood_movies)}' from Bollywood!"

elif preference == "hollywood":

return f"I recommend '{[Link](hollywood_movies)}' from Hollywood!"

elif preference in regional_movies:

return f"I recommend '{[Link](regional_movies[preference])}' from


{[Link]()}!"

else:

return "I'm sorry, I don't have a recommendation for that preference."

#For Facts1 elif "fact" in

user_input.lower():

topic = input("What topic are you interested in


(science/history/geography/technology/sports)? ").lower()

if topic in facts:

return [Link](facts[topic])
else:

return "I'm sorry, I don't have a fact for that topic."

#For Study Tips elif "study tip" in

user_input.lower(): return

[Link](study_tips)

#For Life Hacks elif "life hack" in

user_input.lower(): return

[Link](life_hacks) #For

Relationship Tips elif "relationship tip" in

user_input.lower(): return

[Link](relationship_tips)

#for Today Date elif "todays date" in

user_input.lower(): today = [Link]()

return f"Today is {[Link]('%A, %B %d, %Y')}."

#for Gift Ideas elif "gift ideas" in

user_input.lower(): return

[Link](gift_ideas) #for game

reccmondations elif "game recommendation" in

user_input.lower(): return

[Link](game_recommendations)

#for TvSeries+ elif "tv series recommendation" in

user_input.lower(): return

[Link](tv_series_recommendations)

#for recipies elif "recipie" in

user_input.lower(): return

[Link](recipie_recommendat

ions)
#User's name and age elif "your

name" in user_input.lower():

return "I'm a chatbot, I don't have a [Link] you can call Default! Nice to meet you by
the way!" elif "your age" in user_input.lower(): return "I don't age! How about you?"

# If no specific match, provide a generic response

else:

return "Sorry, I didn't understand that. Can you please rephrase?"

#API for Recipies

api_key = "YOUR_SPOONACULAR_API_KEY"

# Main function to interact with the chatbot def

main():

print("Welcome to the ChatBot!")

print("Type 'exit' to end the conversation.")

while True:

user_input = input("You: ")

# Check if user wants to exit if

user_input.lower() == "exit":

print("ChatBot: Goodbye!")

break

# Generate a response from the chatbot

response = chatbot_response(user_input)

print("ChatBot:", response) # Start the

conversation if __name__ == "__main__":

main()
Outputs
Conclusion
In conclusion, this project successfully designed and built a chatbot using Python and natural
language processing (NLP) techniques. The chatbot demonstrated its ability to engage in basic
conversations, answer frequently asked questions, and provide helpful responses to user
inquiries.
Building a chatbot using Python and NLP techniques is a feasible and rewarding project
- The chatbot has the potential to provide valuable assistance to users in various domains
- Continued research and development are needed to refine the chatbot's capabilities and explore
new applications.
References

1. "Python Crash Course" by Eric Matthes


2. "Automate the Boring Stuff with Python" by Al Sweigart
3. "Python for Data Analysis" by Wes McKinney
4. W3Schools Python Tutorial
5. Python Tutorial by Tutorials Point
6. Real Python
ANNEXURE II

Evaluation Sheet for Micro Project

Academic Year:-2024-25 Name of Faculty :- [Link].P.P

Course:-Computer Course Code:-22616 Semester : VI

Title of Project :- Chatbot using Python

Cos addressed by the Micro Project :


1.2.1 Use basic management principles to execute dailyactivities.
1.2.2 Apply principles of safety management in allactivities.
1.2.3 Understand various provisions of industrialacts.

Major Learning Outcomes achieved by students by doing the project :-

a) Practical Outcomes…………………………………………………………………

b) Unit Outcomes in Cognitive domain………………………………………………


………………………………………………………………………………

c) Outcomes in AffectiveDomain
……………………………………………………………………………………………………

……………………………………………………………………………………………………
……………………………………………………………………………………………………

Comments /suggestions about team work/leadership/inter-personal communication (if any)

………………………………………………………………………………………………………

Roll Marks out of 6 Marks out of 4


No. for for
Student Name performance in performance in Total Out
group activity oral / of 10
(D5 Col.8) presentation
(D5 Col.9)
12 Auti Sakshi Sandeep

[Link].J.G
(Name & Signature of faculty)

You might also like