0%
Block workspaceHow a chatbot works, by building one/15 min

Next word, in blocks

The task

Graded on four lines your program prints. Labels have to be spelled exactly as shown.

  1. Make word patterns called patterns with a context of 1 word, and have them learn the patterns in the text in file passage.txt.
  2. Say after she comes then what the patterns guess follows she. Say how sure then how sure they are, out of 100, after she.
  3. Generate greedily. Set word to the and line to the. Repeat 20 times: set word to the guess after word, then join it onto line with a space. Say greedy then line.
  4. Generate with randomness. The same 20 step loop, but with a random word after word at temperature 1 and top-p 1. Say random then line.

Run it three times and read the two generated lines each time. One of them changes and one does not, and the debrief is about why.

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.