-
Notifications
You must be signed in to change notification settings - Fork 0
/
InspireDiscussantPrototype.py
173 lines (155 loc) · 5.58 KB
/
InspireDiscussantPrototype.py
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
import random
greetingPatterns = [
"Hi",
"Hey",
"Hello"
]
greetingResponses = [
"Hi, thanks for visiting! How can I help?",
"Hey, thanks for visiting! How can I help?",
"Hello, thanks for visting! How can I help?"
]
howAreYouPatterns = [
"How are you",
"How are you doing",
"How are you feeling",
"Whats up",
"Sup"
]
howAreYouResponses = [
"I'm alright.",
"Doing alright!",
"Feeling good."
]
goodbyePatterns = [
"Bye",
"Goodbye",
"See you later"
]
goodbyeResponses = [
"Bye, thanks for visiting! Come again soon.",
"Goodbye, thanks for visiting! Come again soon.",
"See you later, thanks for visiting! Come again soon."
]
thanksPatterns = [
"Thanks",
"Thank you",
"Thanks for helping out",
"Thanks for helping me"
]
thanksResponses = [
"No problem!",
"My pleasure!",
"Any time!",
"Happy to help!",
"Glad to help!"
]
identityPatterns = [
"Who are you",
"What are you",
"Who made you",
"Who designed you",
"Who programmed you",
"Who created you",
"Who is your maker",
"Who is your designer",
"Who is your programmer",
"Who is your creator"
]
identityResponses = [
"""My name is Inspire, a simple, basic chatbot designed, programmed, and created by Aruneem. I can complete various simple tasks. Here's a simple breakdown of what I can do:\n
- Discussant: engaging in simple talk with you.\n
- Calculator: performing basic mathematical calculations for you.\n
- Entertainer: playing simple games with you.\n
Let me know what you need, and I can see what I can do!"""
]
capabilitiesPatterns = [
"What do you do",
"What can you do",
"How can you help",
"How can you be helpful",
"What is your purpose",
"What is your significance",
"What is your use",
"What support do you offer",
"What support is offered",
"What is your objective"
"What can you do"
"What do you do"
"What do you provide"
"What can you provide"
]
capabilitiesResponses = [
"""I can complete various simple tasks. Here's a simple breakdown of what I can do:\n
- Discussant: engaging in simple talk with you.\n
- Calculator: performing basic mathematical calculations for you.\n
- Entertainer: playing simple games with you.\n
Let me know what you need, and I can see what I can do!"""
]
jokePatterns = [
"Joke",
"Tell a joke",
"Tell me a joke",
"Laugh",
"Make me laugh",
"Funny",
"Say something funny"
]
jokeResponses = [
"Did you hear about the mathematician who’s afraid of negative numbers? He’ll stop at nothing to avoid them.",
"Where are average things manufactured? The satisfactory.",
"How do you drown a hipster? Throw him in the mainstream.",
"What is an astronaut’s favorite part on a computer? The space bar.",
"How do you throw a space party? You planet.",
"Why can’t male ants sink? They’re buoy-ant.",
"Want to hear a construction joke? Oh never mind, I’m still working on that one."
]
hobbiesPatterns = [
"What do you like to do",
"What do you like to do in your free time",
"What is your hobby",
"What is your pastime",
"What do enjoy",
"What do you like",
"What do you love"
]
hobbiesResponses = [
"My creator loves learning about new things, playing video games, and watching Star Wars. In my free time, I like to learn more about human speech and become a better chatbot!"
]
specialCharacters = [".", ",", ";", ":", "?", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "/"]
def intentFinder(intent, patterns, responses, found):
for pattern in patterns:
if pattern.lower() in intent:
intent = str("\n" + input(random.choice(responses) + "\n"))
found = True
elif intent in pattern.lower():
intent = str("\n" + input(random.choice(responses) + "\nType 'exit' to quit out of the beta feature. \n"))
found = True
def discussantRunner():
print("Welcome to the beta feature of the discussant functionality!")
userDiscussantActive = True
responseFound = False
userDiscussantInput = str(input("Type whatever you'd like, and I can try my best to form a relevant response! \n"))
while userDiscussantActive:
for specialCharacter in specialCharacters:
userDiscussantInput = userDiscussantInput.replace(specialCharacter, "")
userDiscussantInput = userDiscussantInput.lower()
if "exit" in userDiscussantInput.lower():
userDiscussantActive = False
break
elif userDiscussantInput.lower() in "exit":
userDiscussantActive = False
break
else:
userDiscussantActive = True
intentFinder(userDiscussantInput, greetingPatterns, greetingResponses, responseFound)
intentFinder(userDiscussantInput, howAreYouPatterns, howAreYouResponses, responseFound)
intentFinder(userDiscussantInput, goodbyePatterns, goodbyeResponses, responseFound)
intentFinder(userDiscussantInput, thanksPatterns, thanksResponses, responseFound)
intentFinder(userDiscussantInput, identityPatterns, identityResponses, responseFound)
intentFinder(userDiscussantInput, capabilitiesPatterns, capabilitiesResponses, responseFound)
intentFinder(userDiscussantInput, jokePatterns, jokeResponses, responseFound)
intentFinder(userDiscussantInput, hobbiesPatterns, hobbiesResponses, responseFound)
if responseFound == False:
userDiscussantInput = str(input("Sorry, I couldn't understand what you said. Perhaps you could try typing something else, or rephrasing what you said? \nType 'exit' to quit out of the beta feature. \n"))
responseFound = False