# AI Joke Bot v2 - Community Ratings Added!

Slide 1 of 12
🤖✨
Joke Bot v2.0 Launch!
AI + Community = Super Smart Bot!
Now with community ratings and smarter AI!

## Class Rules

### How to Earn Points Today:

+2 Points - You're here and ready to learn!

+1 Point - You listen during instruction

+1 Point - You try all the activities

+1 Point - You complete all the work

✨ Cool Fact: You helped build this bot! Your ratings make it smarter!

## What's New in v2.0?

Our joke bot got a MAJOR upgrade!

1. 🎭 Community Voting: Rate jokes with 👍, 👎, or 😐
2. 🧠 AI vs Humans: Compare computer guesses with real votes
3. 🗳️ Many-to-One: Many people can rate each joke
4. 📊 Smart Statistics: See what jokes are REALLY popular
5. 💾 Database Upgrade: New table for storing all votes

🎮 Think of it like this: Our joke bot was good, but now it's like adding multiplayer mode to a game!

## The Big Upgrade: Community Ratings!

### v1.0: Just AI Guesses

Old system: Only the computer guessed if jokes were funny.

#### AI Says: 😊 Positive

"Why don't eggs tell jokes?"

Score: +0.90

### v2.0: AI + REAL People!

New system: Both computer AND humans vote on jokes!

👍 85%
😐 10%
👎 5%

Example Joke: "Why don't scientists trust atoms?"

AI Thinks: 😊 Positive (Score: +0.75)

Community Says: 👍 92% funny! (46 votes)

🤯 Mind Blown Fact: This is how YouTube, TikTok, and Netflix work - they combine AI guesses with real user ratings!

## Try It Yourself! 🎯

### Step-by-Step Demo:

1. Step 1: Bot shows you a joke
2. Step 2: You see AI's guess (😊/😐/😒)
3. Step 3: YOU get to vote! 👍, 👎, or 😐
4. Step 4: Your vote gets saved with everyone else's
5. Step 5: Next person sees the community score

### 📱 What You See Now:

🤣 "Why don't eggs tell jokes? They'd crack each other up!"

🤖 AI Mood: 😊 Positive (Score: +0.90)

👥 Community Rating: 👍 85% | 😐 10% | 👎 5%

🗳️ 124 people voted

Was this joke funny to YOU?

1. 👍 Upvote 2. 😐 Neutral 3. 👎 Downvote

💡 This is like: YouTube comments + TikTok likes + Netflix ratings all in one joke bot!

## Behind the Scenes: Database Magic 🗄️

### OLD Database (v1.0):

jokes table: ├── id ├── joke_text ├── contributor ├── published_date ├── ai_score ← Only AI's guess └── ai_mood_label

### NEW Database (v2.0):

jokes table: user_sentiments table: ├── id ├── id ├── joke_text ├── joke_id → Links to jokes ├── contributor ├── user_name ├── published_date ├── sentiment → 'up','down','neutral' ├── ai_score ← AI's guess └── timestamp └── ai_mood_label └── ← MANY votes per joke!

### 🧩 Many-to-One Relationship:

- One Joke can have MANY votes
- Like one YouTube video → many likes/comments
- Like one TikTok → many hearts
- This is called a "foreign key" relationship

## The Smart New Code ✨

### 1. New Database Table:

CREATE TABLE user_sentiments ( id INTEGER PRIMARY KEY, joke_id INTEGER, # Which joke user_name TEXT, # Who voted sentiment TEXT, # 'up','down','neutral' timestamp TEXT, # When they voted FOREIGN KEY (joke_id) REFERENCES jokes(id) # The magic link! );

### 2. Asking for Your Vote:

# After showing a joke... print("🤣 Why don't eggs tell jokes? They'd crack each other up!") print("🤖 AI thinks: 😊 Positive (Score: +0.90)") # Get community rating community_score = get_community_rating(joke_id) print(f"👥 Community: 👍 {community_score['up']}%") # Ask for YOUR vote! print("🗳️ Was this funny to YOU?") print("1. 👍 Upvote 2. 😐 Neutral 3. 👎 Downvote") user_choice = input("Your choice: ") # Save your vote save_user_vote(joke_id, your_name, user_choice)

⚡ Pro Tip: The "FOREIGN KEY" is what links votes to specific jokes. It's like adding @mentions in social media!

## AI vs Humans - The Showdown! 🥊

### Now We Can Compare:

Joke | 🤖 AI Guesses | 👥 Humans Vote | Who's Right?
--- | --- | --- | ---
"Why don't scientists trust atoms?" | 😊 Positive (+0.75) | 👍 92% funny | ✅ Both agree!
"Parallel lines have so much in common..." | 😒 Negative (-0.35) | 👍 78% funny | ❌ AI wrong!
"I told my computer I needed a break..." | 😐 Neutral (0.05) | 👎 65% not funny | ❌ AI wrong!

### 🎯 What This Teaches Us:

- AI gets it right sometimes - Good at obvious jokes
- AI gets it wrong sometimes - Bad at sarcasm/complex jokes
- Humans are better judges - We understand context
- Community voting is powerful - Wisdom of the crowd!

🧠 Real AI Learning: Some AI systems use human votes like this to LEARN and get better! Your votes could train future AI!

## Where You've Seen This Before 🎬

### Everywhere! This is how real apps work:

#### 📱 YouTube

👍👎 buttons

Comments + AI recommendations

Exactly like our joke bot!

#### 📸 TikTok/Instagram

❤️ hearts = upvotes

AI suggests videos you'll like

Community + AI working together

#### 🎮 Online Games

Report systems

Player ratings

Community moderation

### 🎯 The Big Idea:

Modern apps = AI + Community Feedback

- AI starts the guess (like our TextBlob sentiment)
- Humans give feedback (your 👍/👎 votes)
- System gets smarter (learns from both)
- Better experience for everyone!

🚀 Career Connection: Knowing how to build AI + community systems is a SUPER valuable skill for app developers!

## What YOU Built Today 🏗️

Think about it - you helped build a system that:

1. 🤖 Uses AI to analyze text feelings
2. 🗳️ Collects community votes from real people
3. 💾 Stores everything in a smart database
4. 🔗 Links votes to jokes with foreign keys
5. 📊 Shows statistics comparing AI vs humans

🌟 That's Professional-Level Work!

Companies build apps the exact same way:

- YouTube = videos + likes/dislikes
- Amazon = products + star ratings
- Netflix = shows + thumbs up/down
- Our Joke Bot = jokes + 👍/👎 ratings!

💪 You're Not Just Learning - You're Building Real Stuff!

The skills you learned today (AI + databases + user feedback) are exactly what tech companies look for!

## What Could We Build Next? 🚀

### Discussion Time:

- What jokes did the AI get totally wrong? Why?
- Should some people's votes count more? (Like joke experts?)
- What if we could "train" the AI with our votes?
- Could we predict which jokes will be popular?

### 🎯 Cool Extension Ideas:

- Personalized Jokes: "Show me jokes that people LIKE ME enjoyed!"
- Joke Leaderboard: Top 10 most-liked jokes
- AI Trainer: Use votes to make TextBlob smarter
- Meme Version: Same system but for memes!
- Class Poll System: Use this code for classroom votes

### 🧠 The Real Magic:

You now have a template for ANY voting system:

Song ratings, game reviews, teacher feedback, club elections...

Change the jokes to something else, keep the voting system!

🤖👥✨

# You Built Version 2.0!

🎯 Remember What You Accomplished:

- Started with basic joke storage (v1.0)
- Added AI mood detection (v1.5)
- Now added COMMUNITY voting (v2.0!)
- You built a system used by billion-dollar companies
- You understand AI + Human collaboration

📈 Career Superpower: You now know how to build interactive, community-driven, AI-enhanced apps. That's literally what modern software development is all about!

Next Challenge: Can we make the AI LEARN from our votes? 🤔

ICT & Digital Technologies
Year 9 - Building Real Apps