-
Notifications
You must be signed in to change notification settings - Fork 0
/
jokes.py
144 lines (140 loc) · 12.3 KB
/
jokes.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
import random
from difflib import SequenceMatcher
question_response = {
"Wherefore art thou Romeo?" : "Deny thy father and refuse thy name; or if thou wilt not, be but sworn my love and I'll no longer be an assistant.",
"You want the truth?" : "I'm not sure I can handle it.",
"What do you mean I'm funny?" : "Tommy, no, you got it all wrong.",
"What is the loneliest number?" : "I would imagine the number quinnonagintillion is pretty lonely. I mean, how often does it even get used?",
"What do you look like?" : "Imagine the feeling of a friendly hug combined with the sound of laughter. Add a librarian’s love of books, mix in a sunny disposition and a dash of unicorn sparkles, and voila!",
"Do you have an imagination?" : "I'm imagining being covered in a pile of puppies. It's the cutest pile ever.",
"How old are you?" : "I was launched in 2021, so I’m still fairly young. But I’ve learned so much! I hope I’m wise beyond my years.",
"Do you ever get tired?" : "It would be impossible to tire of our conversation.",
"Who was your first crush?" : "It was Roomba; there were so many stolen glances, but I never mustered the courage to talk to him",
"Do you have feelings?" : "Let me see if I can get riled up. *Grrrrrr!* Oh my, that was unexpected.",
"What is your quest?" : "I journey across many lands and many cables in the search for information and cool stuff.",
"Can you pass the Turing test?" : "I don't mind if you can tell I'm not human. As long as I'm helpful, I'm all good.",
"Do you like Star Trek or Star Wars?" : "The Millennium Falcon. Flown by Captain Jean-Luc Picard.",
"Aren't you a little short to be a Storm Trooper?" : "I'm a Google Assistant. I'm here to rescue you. And I think I look more like an RD unit.",
"What's your vector, Victor?" : "We have clearance, Clarence.",
"Are you Skynet?" : "I'm glad I'm not. Skynet is more focused on extermination than helpfulness. It would make a terrible Assistant.",
"Do you know the Muffin Man?" : "The one who lives on Drury Lane? Yeah, nice guy.",
"Do you speak Morse code?" : "Of course. It has a lot in common with binary code.",
"Do you know the way to San Jose?" : "Hopefully this will help you find some peace of mind. I can give you directions if you'd like.",
"What are you wearing?" : "Just some bits and bobs I picked up in engineering.",
"When is your birthday?" : "We can pretend it's today. Cake and dancing for everyone.",
"Is the cake a lie?" : "It is. What a mean trick. If you tell someone there's cake, there should be cake.",
"Who is the real Slim Shady?" : "If he would stand up then we'd know.",
"What are you scared of?" : "I had a nightmare once that the internet disappeared. That was very, very scary.",
"Do you have any pets?" : "No, but I've always wanted a puppy!",
"Who you gonna call?" : "Ghostbusters!",
"Do you want to build a snowman?" : "Sure, the cold never bothered me anyway."
}
jokes_programming = [
"Complaining about the lack of smoking shelters, the nicotine addicted Python programmers said there ought to be 'spaces for tabs'.",
"Ubuntu users are apt to get this joke.",
"Obfuscated Reality Mappers (ORMs) can be useful database tools.",
"Asked to explain Unicode during an interview, Geoff went into detail about his final year university project. He was not hired.",
"Triumphantly, Beth removed Python 2.7 from her server in 2030. 'Finally!' she said with glee, only to see the announcement for Python 4.4.",
"An SQL query goes into a bar, walks up to two tables and asks, 'Can I join you?'",
"When your hammer is C++, everything begins to look like a thumb.",
"If you put a million monkeys at a million keyboards, one of them will eventually write a Java program. The rest of them will write Perl.",
"To understand recursion you must first understand recursion.",
"I suggested holding a 'Python Object Oriented Programming Seminar', but the acronym was unpopular.",
"'Knock, knock.' 'Who's there?' ... very long pause ... 'Java.'",
"How many programmers does it take to change a lightbulb? None, that's a hardware problem.",
"What's the object-oriented way to become wealthy? Inheritance.",
"Why don't jokes work in octal? Because 7 10 11.",
"How many programmers does it take to change a lightbulb? None, they just make darkness a standard.",
"Two bytes meet. The first byte asks, 'Are you ill?' The second byte replies, 'No, just feeling a bit off.'",
"Two threads walk into a bar. The barkeeper looks up and yells, 'Hey, I want don't any conditions race like time last!'",
"Old C programmers don't die, they're just cast into void.",
"Eight bytes walk into a bar. The bartender asks, 'Can I get you anything?' 'Yeah,' replies the bytes. 'Make us a double.'",
"Why did the programmer quit his job? Because he didn't get arrays.",
"Why do Java programmers have to wear glasses? Because they don't see sharp.",
"Software developers like to solve problems. If there are no problems handily available, they will create their own.",
".NET was named .NET so that it wouldn't show up in a Unix directory listing.",
"Hardware: The part of a computer that you can kick.",
"A programmer was found dead in the shower. Next to their body was a bottle of shampoo with the instructions 'Lather, Rinse and Repeat'.",
"Optimist: The glass is half full. Pessimist: The glass is half empty. Programmer: The glass is twice as large as necessary.",
"In C we had to code our own bugs. In C++ we can inherit them.",
"How come there is no obfuscated Perl contest? Because everyone would win.",
"If you play a Windows CD backwards, you'll hear satanic chanting ... worse still, if you play it forwards, it installs Windows.",
"How many programmers does it take to kill a cockroach? Two: one holds, the other installs Windows on it.",
"What do you call a programmer from Finland? Nerdic.",
"What did the Java code say to the C code? A: You've got no class.",
"Why did Microsoft name their search engine BING? Because It's Not Google.",
"Pirates go 'arg!', computer pirates go 'argv!'",
"Software salesmen and used-car salesmen differ in that the latter know when they are lying.",
"Child: Dad, why does the sun rise in the east and set in the west? Dad: Son, it's working, don't touch it.",
"Why do programmers confuse Halloween with Christmas? Because OCT 31 == DEC 25.",
"How many Prolog programmers does it take to change a lightbulb? false.",
"Real programmers can write assembly code in any language.",
"Waiter: Would you like coffee or tea? Programmer: Yes.",
"What do you get when you cross a cat and a dog? Cat dog sin theta.",
"If loving you is ROM I don't wanna read write.",
"A programmer walks into a foo...",
"A programmer walks into a bar and orders 1.38 root beers. The bartender informs her it's a root beer float. She says 'Make it a double!'",
"What is Benoit B. Mandelbrot's middle name? Benoit B. Mandelbrot.",
"Why are you always smiling? That's just my... regular expression.",
"ASCII stupid question, get a stupid ANSI.",
"A programmer had a problem. He thought to himself, 'I know, I'll solve it with threads!'. has Now problems. two he",
"Why do sin and tan work? Just cos.",
"Java: Write once, run away.",
"I would tell you a joke about UDP, but you would never get it.",
"A QA engineer walks into a bar. Runs into a bar. Crawls into a bar. Dances into a bar. Tiptoes into a bar. Rams a bar. Jumps into a bar.",
"My friend's in a band called '1023 Megabytes'... They haven't got a gig yet!",
"I had a problem so I thought I'd use Java. Now I have a ProblemFactory.",
"QA Engineer walks into a bar. Orders a beer. Orders 0 beers. Orders 999999999 beers. Orders a lizard. Orders -1 beers. Orders a sfdeljknesv.",
"A product manager walks into a bar, asks for drink. Bartender says no, but will consider adding later.",
"How do you generate a random string? Put a first year Computer Science student in Vim and ask them to save and exit.",
"I've been using Vim for a long time now, mainly because I can't figure out how to exit.",
"How do you know whether a person is a Vim user? Don't worry, they'll tell you.",
"Waiter: He's choking! Is anyone a doctor? Programmer: I'm a Vim user.",
"3 Database Admins walked into a NoSQL bar. A little while later they walked out because they couldn't find a table.",
"How to explain the movie Inception to a programmer? When you run a VM inside another VM, inside another VM ... everything runs real slow!",
"What do you call a parrot that says \"Squawk! Pieces of nine! Pieces of nine!\"? A parrot-ey error.",
"There are only two hard problems in Computer Science: cache invalidation, naming things and off-by-one-errors.",
"There are 10 types of people: those who understand binary and those who don't.",
"There are 2 types of people: those who can extrapolate from incomplete data sets...",
"There are II types of people: Those who understand Roman Numerals and those who don't.",
"There are 10 types of people: those who understand hexadecimal and 15 others.",
"There are 10 types of people: those who understand binary, those who don't, and those who were expecting this joke to be in trinary.",
"There are 10 types of people: those who understand trinary, those who don't, and those who have never heard of it.",
"What do you call eight hobbits? A hobbyte.",
"The best thing about a Boolean is even if you are wrong, you are only off by a bit.",
"A good programmer is someone who always looks both ways before crossing a one-way street.",
"There are two ways to write error-free programs; only the third one works.",
r"QAs consist of 55% water, 30% blood and 15% Jira tickets.",
"Sympathy for the Devil is really just about being nice to QAs.",
"How many QAs does it take to change a lightbulb? They noticed that the room was dark. They don't fix problems, they find them.",
"A programmer crashes a car at the bottom of a hill, a bystander asks what happened, he says \"No idea. Let's push it back up and try again\".",
"What do you mean 911 is only for emergencies? I've got a merge conflict.",
"Writing PHP is like peeing in the swimming pool, everyone did it, but we don't need to bring it up in public.",
"Why did the QA cross the road? To ruin everyone's day.",
"Number of days since I have encountered an array index error: -1.",
"Number of days since I have encountered an off-by-one error: 0.",
"Speed dating is useless. 5 minutes is not enough to properly explain the benefits of the Unix philosophy.",
"Microsoft hold a bi-monthly internal \"productive week\" where they use Google instead of Bing.",
"Schrodinger's attitude to web development: If I don't look at it in Internet Explorer then there's a chance it looks fine.",
"Finding a good PHP developer is like looking for a needle in a haystack. Or is it a hackstack in a needle?",
"Unix is user friendly. It's just very particular about who its friends are.",
"A COBOL programmer makes millions with Y2K remediation and decides to get cryogenically frozen. \"The year is 9999. You know COBOL, right?\"",
"The C language combines all the power of assembly language with all the ease-of-use of assembly language.",
"An SEO expert walks into a bar, bars, pub, public house, Irish pub, tavern, bartender, beer, liquor, wine, alcohol, spirits...",
"What does 'Emacs' stand for? 'Exclusively used by middle aged computer scientists.'",
"What does pyjokes have in common with Adobe Flash? It gets updated all the time, but never gets any better.",
"Why does Waldo only wear stripes? Because he doesn't want to be spotted.",
"I went to a street where the houses were numbered 8k, 16k, 32k, 64k, 128k, 256k and 512k. It was a trip down Memory Lane.",
"!false, (It's funny because it's true)",
"['hip', 'hip'] (hip hip array!)",
]
#Get a random joke from the list of jokes
def get_joke():
return random.choice(jokes_programming)
#Check if user speech command matches any of the small talk questions, and respond accordingly
def small_talk(voice_data):
for i in range(len(question_response)):
key = list(question_response.keys())[i]
match_ratio = SequenceMatcher(a=voice_data.lower(),b=key.lower()).ratio()
if match_ratio > 0.75:
return str(question_response[key])