bestdadjokes/check_jokes.py

37 lines
2.3 KiB
Python

import json
with open('content/jokes.json', 'r') as f:
data = json.load(f)
setups = {j.get("setup", "").strip().lower() for j in data.get("jokes", [])}
new_jokes = [
{"setup": "What do you call a factory that makes okay products?", "punch": "A satisfactory.", "cat": "work"},
{"setup": "Why can't you hear a pterodactyl go to the bathroom?", "punch": "Because the 'P' is silent.", "cat": "history"},
{"setup": "How do you organize a space party?", "punch": "You planet.", "cat": "space"},
{"setup": "Why are ghosts such bad liars?", "punch": "Because you can see right through them.", "cat": "spooky"},
{"setup": "What did the zero say to the eight?", "punch": "Nice belt.", "cat": "school"},
{"setup": "What do you call a sleeping dinosaur?", "punch": "A dino-snore.", "cat": "history"},
{"setup": "Why do seagulls fly over the ocean?", "punch": "Because if they flew over the bay, we'd call them bagels.", "cat": "animals"},
{"setup": "What does a cloud wear under his raincoat?", "punch": "Thunderwear.", "cat": "weather"},
{"setup": "Why did the tomato turn red?", "punch": "Because it saw the salad dressing.", "cat": "food"},
{"setup": "What did one wall say to the other?", "punch": "I'll meet you at the corner.", "cat": "family"},
{"setup": "Why did the cookie go to the hospital?", "punch": "Because he felt crummy.", "cat": "food"},
{"setup": "What do you call a messy hippo?", "punch": "A hippopotamess.", "cat": "animals"},
{"setup": "How do mountains see?", "punch": "They peak.", "cat": "travel"},
{"setup": "Why did the stadium get hot after the game?", "punch": "Because all the fans left.", "cat": "sports"},
{"setup": "What did the janitor say when he jumped out of the closet?", "punch": "Supplies!", "cat": "work"},
{"setup": "Why don't skeletons fight each other?", "punch": "They don't have the stomach for it.", "cat": "halloween"},
{"setup": "What do you call a snowman with a six-pack?", "punch": "An abdominal snowman.", "cat": "winter"},
{"setup": "Why did the math book look sad?", "punch": "Because it had too many problems.", "cat": "school"}
]
unique_jokes = []
for joke in new_jokes:
if joke['setup'].lower() not in setups:
unique_jokes.append(joke)
print(f"UNIQUE COUNT: {len(unique_jokes)}")
for joke in unique_jokes[:10]:
print(f"UNIQUE: {joke['setup']}")