Jul 6 at 12am - Jul 17 at 11:59pm
This assignment was locked Jul 17 at 11:59pm.
In this lab, you will create a simple sentence generator using lists.
If you haven't already - you might want to open the Glossary Of Terms for Unit 4 in a new tab.
Create a variable for each part of speech below, and set each variable to hold a list of words that fit that part of speech. Some examples are given, but feel free to use your own. Though the temptation is strong, keep it school appropriate (and the memes to a minimum).
Part of Speech
giraffe, monkey, boy, girl, elephant, ...
jumps, runs, sleeps, sits, dances, ...
big, small, loud, silly, young, old, sleepy, ...
quickly, excitedly, angrily, happily, sadly, ...
under, over, around, near, beside, ...
Write a custom reporter block called "noun phrase" that reports a noun phrase where each word is chosen randomly from the lists you created. A noun phrase consists of an article, an adjective, and a noun in that order.
Write custom reporter blocks like "noun phrase" for each of the phrase types listed below.
preposition + noun phrase
adverb + verb + prepositional phrase
noun phrase + verb phrase
Write code so that when you press the space bar, a random sentence is generated and a sprite says the resulting sentence.
BONUS: Modify your code so that a noun phrase can either be the construction from part 1.2 or a single proper noun (e.g. a person's name). Your code should randomly decide which version of a noun phrase to use.
BONUS: Modify your code so that a verb phrase can sometimes leave out the prepositional phrase. Your code should randomly decide to include the prepositional phrase or not. Don't spend too long struggling over these bonuses unless you've already finished the next part (they are only a 1/2 point each; the next part is easier and worth more points overall).
Changing Our Vocabulary
Write a script so that when the 'n' key is pressed, the user is prompted for a new noun and that noun is added to list of nouns. After that point, the new noun entered by the user should be able to appear in sentences.
Write scripts like the one you wrote in part 2.1 to add words to the other lists. Use the keys listed below.
Part of speech
Write a script so that when the 'x' key is pressed, the user is asked for one of the parts of speech and then for a number (n). Your script should remove the nth item from the list of words for the specified part of speech. For example, if the user types in "verb" and "3" then you should remove the 3rd word from the list of verbs. The removed word should no longer appear in sentences.
Can't change a rubric once you've started using it.
This criterion is linked to a Learning OutcomeReporting Phrases: Is there a custom reporter block called "noun phrase" that reports a noun phrase with randomly chosen article, adjective, and noun, in that order?220960_3352
This criterion is linked to a Learning OutcomeChanging Our Vocabulary: Are there scripts that prompt for other parts of speech and add them to the appropriate list when the following keys are pressed? (v-verb, j - adjective, d - adverb, a - article, p - preposition)220960_4493
This criterion is linked to a Learning OutcomeChanging Our Vocabulary: Is there a script that removes the specified item from the specified list when the user presses the 'x' key? (For example, if the user types in "verb" and "3" then you should remove the 3rd word from the list of verbs. The removed word should no longer appear in sentences.)220960_2355