Open the Spell Checker Starter File and click "Run". Follow each of the instructions below to discover how our very own Pyret spell checker works.

1 In the Spell Checker Starter File, the function alt-words consumes a string and a dictionary…​ but what does it produce?

  • Test alt-words("straw", WORDS) in the Interactions Area and record the results in the left column of the table below.

  • In the second column, describe how each option differs from the input string ("straw").

  • In the third column, record how many edits to the string "straw" this algorithm makes. (A single edit could entail replacing one letter with a different one, for instance.)

Suggestion How it’s different from the string "straw" Number of Edits

2 Test alt-words("planet", WORDS) in the Interactions Area.

  • Notice that "planet" has six letters, but all of the suggested words have five letters. What else can you conclude about the spell checker’s algorithm?

  • To get from "planet" to "plait", delete and change to .

  • To get from "planet" to "plank", delete and change to .

  • The spell checker makes just one edit when it proposes as a match for "planet".

Experiment with the alt-words function to answer the questions below, testing what it produces using Strings from your imagination.

3 We have seen multiple two-edit changes. Does the program propose words that include three edits?

4 What is the maximum length string that this spell checker will accept?

  • Why does that maximum length make sense with what we know about the algorithm?

5 What else do you notice?

6 Does this spell check program use the same algorithm as the The First Spell Checker?

  • If not, what is different and how do you know?

  • Which spell checker do you think is more effective? Why?

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, 1738598, 2031479, and 1501927). CCbadge Bootstrap by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.