Due: Wednesday 11/06 10:00am

Submission name: work18.rkt

Setup

  1. First, download the sentence.rkt
  2. You will need 3 plain text files, call them nouns.txt, verbs.txt, adjectives.txt. Put the correct kinds of words in those files, one word per line.

Better sentences

  1. Sometimes, we put articles like “the” or “a” in front of a noun (or wordy-noun). Modify noun-phrase so that there is a 50% chance of either:
    • Returning a “wordy-noun”.
    • Adding an article to the beginning of a “wordy-noun” list.
  2. A simple sentence contains a subject (in this case a noun-phrase) and a verb, eg “the cat eats”. Sometimes it’s nice to add an object after the verb, eg “the cat eats a fish”. Modify verb-phrase so that there is a 50% chance of either:
    • Returning a list with verb in it.
    • Returning a list with a verb followed by a noun-phrase.
    • To get this working, you’ll need to use th append function we discussed today in class. There is also an example of append in the sentence function.

Better-er sentences

  1. Make sure each txt file has at least 10 words.
  2. Currently, wordy-noun, noun-phrase and verb-phrase each have a 50% chance of returning one of the two options available. What would you modify to change this split. Try to create some of these possibilities:
    • 25% / 75%
    • 40% / 60%
    • 37% / 63%