Learn AI Projects for Kids Make Your Own Chatbot Friend

Make Your Own Chatbot Friend

Beginner 🕐 13 min Lesson 5 of 9
What you'll learn
  • Understand how text classification powers chatbots by matching input messages to learned categories
  • Create a text classification project in Machine Learning for Kids with labeled categories and varied examples
  • Build a Scratch chatbot that uses a trained model to understand messages and give custom responses

What Makes a Chatbot Work?

When you type to a chatbot and it types back, what is actually happening? Most simple chatbots — including the kind you are going to build today — work by recognizing the type of message you sent and choosing a matching response. This is called text classification.

For example, a chatbot might learn that messages like "hello," "hi," and "hey" all belong to the category Greeting, and it should respond with "Hey, great to meet you!" Meanwhile, messages like "what is your name" or "who are you" belong to the category Identity, and it should respond with its name.

The AI part is the text classifier. The creative part — the personality, the responses, the questions the chatbot can answer — is entirely up to you.

Get Started with Machine Learning for Kids

Today you are going to use a platform called Machine Learning for Kids, built by an IBM engineer named Dale Lane. It is completely free and designed for kids aged 8 to 14.

Parent note: To save your work and connect it to Scratch, this platform needs a free IBM Cloud account. Ask a grown-up to help set one up at ibm.com/cloud — the free Lite tier is more than enough. If you just want to explore first, go to machinelearningforkids.co.uk and click Try it now without registering — this lets you test the full platform before creating any accounts.

Once on the site, create a new project. Name it something like "My Chatbot" and choose Text as the type. You are building a text classification model.

Train Your Chatbot's Brain

Now comes the fun part: teaching your chatbot what different messages mean. Create categories for the kinds of things people might say to your chatbot. Here are some ideas to start with:

  • Greeting — add examples like: "hello", "hi", "hey there", "good morning", "howdy"
  • Asking my name — examples: "what is your name", "who are you", "what should I call you"
  • Asking how I feel — examples: "are you happy", "how are you feeling", "what is your mood today"
  • Saying goodbye — examples: "bye", "see you later", "goodbye", "gotta go"

For each category, add at least 8 to 10 different example phrases. The more variety, the better the classifier will be at understanding messages it has never seen before. Think about all the different ways someone might ask the same thing — people are creative and unpredictable.

When your categories are ready, click Train. The model will learn the patterns in your text examples.

Build the Chatbot in Scratch

Machine Learning for Kids connects to Scratch with a special block extension. Once your model is trained, click Make then Scratch 3 from the project page. This opens a special version of Scratch with your AI blocks already loaded.

You will see blocks like recognise text [input] (label) — this sends a text message to your trained model and returns the category it predicted. Build a simple chat interface:

  • Use the ask [] and wait block to get user input.
  • Pass the input to your AI classifier using the recognise text block.
  • Use if / else blocks to check which category was predicted and say the matching response.

Write your chatbot's responses in your own words and give it a personality. Is it cheerful? Does it love space? Does it have a weird catchphrase? Does it tell bad jokes? The AI decides what the message means — but you decide what it says back. That is what makes every chatbot unique.

Key takeaways
  • Chatbots classify the type of message received and choose a matching scripted response
  • Adding more varied example phrases per category helps the model handle unexpected inputs from real users
  • The AI handles understanding the message but the chatbot personality and responses are created entirely by the builder