0%
Block workspaceYour first AI app/15 min

Kind or unkind, in blocks

The task

Graded on four lines your program prints.

Build the same program as "Is it a question?", this time for kind and unkind messages:

  1. A dataset with eight kind examples and eight unkind examples. Vary how they start.
  2. A word matching model called judge, trained on that dataset.
  3. Set message to the line typed in, then set label and sure from it, as in the question recogniser.
  4. The gate: if sure is below 60, say "I am not sure. I need more training examples." Otherwise say "That sounds kind." or "That sounds unkind." to match the label. You can put the verdict inside the otherwise branch, exactly as in the question recogniser, or put the stop the script block from Control straight after the unsure message.

Run asks you for one message in Terminal. Check exercise runs your program three times with prepared messages, so you do not type anything:

  • "you explained that clearly and i really liked it" should get the kind verdict.
  • "you always mess things up" should get the unkind verdict.
  • "the bus leaves at four" should get the unsure message.

Try all three with Run before you press Check. As you saw in "What the model did with your words", the model can only use words that appear in its training examples, so write your examples in the same everyday style people really use when they are kind or unkind. Do not copy the three check messages into your examples: that would be testing on training data, the mistake from Level 2.

Sign in to start

Exercises need an account.

It is free. Log in or create one, and every attempt and pass is saved to your progress.