Actually, this content is now in 3.1.4. --MF, 1/10/20
We discussed moving the TIF up to the top before the FYTD--something like: You can do this whole project in any language you want (your native language or one you are learning.) --MF, 5/22/18
There are some images that need attention on this page. --MF, 6/6/18
PG: This /has/ a learning purpose. It's lost in "optional." The learning purpose is couched in machine generation of language, but the content/programming goals are also practice of old, learning new, and foreshadowing. The important "new" is the essential element of problem decomposition and abstraction: this problem is too difficult /without/ decomposing it, but perfectly tractable /with/ decomposition. And then, perfectly extensible to Spanish or...
MF: Need to revise to follow Modeling Langauge in U1
gossip
, that writes. Now, you can extend the computer's abilities with language by developing a reporter block, plural
, that takes a noun as input and correctly spells and outputs the plural. last letter of
will report if, say, 2017
is its input.)
plural
.plural
block. Build this much and test it out on at least "day" and "boss" and "medicine," to make sure it works correctly for those. If it does not, edit and fix it. plural
does not work correctly. List the words you find. Organize that list, sorting the words into categories according to their last letter. For example, it will get wrong some words that end with the letter h. Try to find many words it gets wrong. Debugging: To write code that works, you want to try to find situations in which it does not work. "Breaking it" requires thinking of wild and exceptional cases, even including inputs that are incorrect in some way, like this example, which has a space at the end.
plural
should now work correctly for "day" and "boss" and "medicine," but it probably doesn't yet work correctly for the word "box" Edit your plural
block to make it work for words that end with x. Test it to make sure it does work properly.
You can do the same for conjugating verbs in Spanish or some other language you choose. See the Take It Further section at the bottom.
The next two steps are worth learning—very useful for testing plural
and in more advanced work later on—but not essential for building plural
.
map
to test all the words on your list. Leave the slot in plural
empty, as you see here. The map
block inserts each element of the list into that slot and reports a list of the results.For now, don't worry about the words it still gets wrong, as long as it works for "day," "boss," "medicine," and "box."
map
script, replace plural
withmap
block does, in general. last letter of
empty, as you see here. That is the placeholder for keep
to test each word the list. Explain what the keep
block does.