-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchatbot.py
More file actions
88 lines (74 loc) · 3.75 KB
/
Copy pathchatbot.py
File metadata and controls
88 lines (74 loc) · 3.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
knowledge = {
# Greetings
"hello":"Hello! Nice to meet you. How can I help you today?",
"hi":"Hi! Welcome to the AI ChatBot.",
"good morning":"Good Morning! Have a productive day.",
"good afternoon":"Good Afternoon!",
"good evening":"Good Evening!",
"bye":"Goodbye! Have a wonderful day.",
"thanks":"You're welcome!",
"thank you":"Happy to help!",
# About
"name":"I am an AI ChatBot developed using Python and Flask.",
"who are you":"I am an intelligent chatbot created for the CodeAlpha Cloud Computing Internship.",
"help":"You can ask me about Python, Programming, AI, Cloud Computing, Flask, HTML, CSS, JavaScript and more.",
# Python
"python":"Python is a high-level programming language widely used for AI, Web Development, Automation and Data Science.",
"flask":"Flask is a lightweight Python web framework.",
"django":"Django is a powerful Python framework for building large web applications.",
"list":"Lists are mutable collections in Python.",
"tuple":"Tuples are immutable collections in Python.",
"dictionary":"Dictionaries store data as key-value pairs.",
"loop":"Python supports for loops and while loops.",
"function":"Functions are reusable blocks of code.",
"class":"Classes are blueprints for objects in Object Oriented Programming.",
# Programming
"c":"C is a procedural programming language.",
"c++":"C++ supports Object Oriented Programming.",
"java":"Java is platform independent because of the JVM.",
"javascript":"JavaScript is mainly used for interactive web pages.",
"html":"HTML is used to structure webpages.",
"css":"CSS is used for styling webpages.",
"sql":"SQL is used to manage relational databases.",
"oop":"Object Oriented Programming is based on classes and objects.",
"dbms":"DBMS stands for Database Management System.",
"os":"Operating System manages hardware and software resources.",
"computer network":"Computer Networks connect devices for communication.",
# AI
"ai":"Artificial Intelligence enables machines to mimic human intelligence.",
"machine learning":"Machine Learning is a subset of AI where systems learn from data.",
"deep learning":"Deep Learning uses neural networks with many layers.",
"nlp":"Natural Language Processing enables computers to understand human language.",
# Cloud
"cloud":"Cloud Computing delivers computing resources over the internet.",
"aws":"AWS stands for Amazon Web Services.",
"azure":"Microsoft Azure is a cloud computing platform.",
"google cloud":"Google Cloud Platform provides cloud services.",
"iaas":"Infrastructure as a Service provides virtual machines.",
"paas":"Platform as a Service provides development environments.",
"saas":"Software as a Service delivers software over the internet.",
"docker":"Docker uses containers to package applications.",
"kubernetes":"Kubernetes manages containerized applications.",
# Career
"resume":"Keep your resume one page, include projects and skills.",
"github":"GitHub is used to host and manage code repositories.",
"linkedin":"LinkedIn helps professionals build their career network.",
"internship":"Internships provide practical industry experience.",
"interview":"Practice DSA, projects and communication for interviews.",
# CodeAlpha
"codealpha":"CodeAlpha offers internship opportunities to students."
}
def get_response(message):
message = message.lower().strip()
# Exact match first
if message in knowledge:
return knowledge[message]
# Match longer keys before shorter ones
sorted_keys = sorted(knowledge.keys(), key=len, reverse=True)
for key in sorted_keys:
if key in message:
return knowledge[key]
return (
"I'm sorry, I don't know the answer to that yet.<br><br>"
"Try asking about Python, Flask, AWS, Cloud Computing, SQL, HTML, CSS, JavaScript, AI, Docker, Kubernetes, GitHub, Resume, Internship and more."
)