Teacher's Choice

Modeling Sentence Structures (Teacher's Choice)

From Observation Notes Analysis: U3L1: "… the sentence generation has to be in English. (This isn't because of anything that happened here, just me reading over shoulders and trying to imagine a kid doing it in Spanish.)"

On this page, you'll use abstraction to create a "Sentence Builder" project that builds complicated sentences like "the little elephant runs happily around the wise pizza" by joining words that represent things, actions, modifiers, and so on.

The join block connects strings of characters given as input without adding spaces, like this: join (the) (elephant) (climbs)

The join words block does the same and adds a space between its inputs, like this: join words (the) (elephant) (climbs)

    • Later, when we have time to do this right, the whole thing should be less 19th century. "B runs up a bill" contains a verb "runs up" not a prepositional phrase "up a bill." Two word nouns like "house boat" and "power adapter" exist, too. These are not adjective-noun combinations. Determiner category is right, and includes "my" and "the" because functionally they are (essentially) the same. And phrases (e.g., adverbial prepositional phrase such as "with great excitement") play a functional part-of-speech role. Grammarbook grammar is really not current thinking in either analytic or computational linguistics. Even though the following functional names are not quite precise, maybe the categories should be things, actions, thing modifiers, action modifiers, determiners, and prepositions (the last because there's not a particularly clear functional title except "relational words" which is way too broad). "Things" could be "things and names," but then it all gets more complicated (actions and states, etc.). I'd stay simple and clear, if incomplete. Do this later unless the picture is going to be changed anyway. If it is changed, use functional names, and add at least one multi-word entry to each list that functions as a single element. (Power adaptor, yells at, red-haired, Sally's dad's, with great excitement, in front of.) We can still use "noun phrase" etc., --PG
    Click on the script below to load it in snap
    lists of nouns, verbs, etc.
    Feel free to change these lists to use your own nouns, verbs, etc. In fact, you may find you need to change some of these words to make the sentences work the way you want.
Alphie and Betty are trying to use the lists of words to build sentences.
Betty: The sentence "the elephant climbs" is just an example. Let's build a block that joins any determiner with a noun and a verb.
They make: join words(articles, nouns, verbs)
Alphie: Looks good to me. Let's run it and see what happens.
Betty clicks and they see: all articles nouns verbs joined
Betty: What? Oh, these are all the words in those lists. We want just one item from each of the three lists.
  1. Save Your WorkFix their expression so that it selects one random item from each of the three lists and puts spaces between the words. Create a reporter called green 'simple sentence' reporter block that uses that expression to generate random sentences.
  2. These phrases will be grammatically correct, but they won't necessarily make sense. For example, noun phrase might generate "a tired pizza."
  3. Make three other reporters that report different kinds of phrases:
    1. green noun phrase reporter block should join words from three categories to create phrases like "the little boy," "a green giraffe," or "our old sandwich."
    2. green prepositional phrase reporter block should combine a preposition with a noun phrase to create phrases like "near the little boy" or "over a wise pizza."
    3. Defining prepositional phrase using the noun phrase block is a good example of abstraction. If you later change noun phrase to include people's names, prepositional phrase will still work.
    4. Save Your Workgreen verb phrase reporter block should join a verb and an adverb to create phrases like "jumps sadly," "naps quickly," or "thinks sleepily."
  4. "Complex sentence" is a technical term in grammar, and this isn't one. Dunno if we have to care. We could call this "long sentence" or something. (A complex sentence is one with a subordinate clause.) --bh
  5. Then, make a reporter green 'complex sentence' reporter block that combines a noun phrase, a verb phrase, and a prepositional phrase.
  6. Now Is a Good Time to Save
 

This page is a very small beginning toward teaching the computer to understand English sentence structure. If you find the topic interesting, there's a lot more you can do; this could be the beginning of your final course project. You don't have to do any of this. If you find it boring, go to the next page. But if you find it interesting, there's a long road from "The blue elephant sits down angrily in front of the television" to "Whether I shall turn out to be the hero of my own life, or whether that station will be held by anybody else, these pages must show." (That's the opening sentence of David Copperfield by Charles Dickens.) Here are a few suggestions to make your sentences more interesting, but don't be limited by them; be creative.

  1. Occasionally include people's names instead of a noun phrase. So, instead of something like "my silly elephant", the program could sometimes use "Alfred" or some other names.
  2. Noun phrases don't always have to have one adjective. They can have none, or two, or more.
  3. Your old Snap! project should be called "U2Lab1-Plural".
  4. Use your plural block from Unit 2 to let your nouns sometimes be plural. Your program may need two separate expressions, one for singular sentences and one for plural ones, since the verb has to match the noun: "the kangaroo jumps" but "the kangaroos jump."
  5. Also, in part D, we should think about whether this is the simplest kind of question. Another candidate would be "Who ...?" which just requires changing noun phrase. (from Brian??)
  6. Find a way to create questions. (The sentence could start with a question phrase like "Who," "Why does," "Did," or "How did." Different question words might require different sentence structures.)
  7. So far you've used verbs that describe an action someone just does (intransitive verbs). Another kind of verb describes an action someone does to someone, or to something, such as "eats" or "sits on" or "loves" (transitive verbs). Make a list of transitive verbs, and make sentences using noun phrase twice, once for the actor and once for the acted-upon.
Now Is a Good Time to Save