Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This question is worth 50% of the assignment mark. Text generation is the process of creating human-readable text using an automated system. In this assignment

image text in transcribedimage text in transcribedimage text in transcribed

This question is worth 50% of the assignment mark. Text generation is the process of creating human-readable text using an automated system. In this assignment we will work on a simple version of the problem: producing pronounceable gibberish text using syllables, and adding punctuation to make sentences. These sentences will be printed, and a dictionary of all of the gibberish "words" that were generated will be printed at the end. There are three main tasks that the program must perform: 1. Generate random words from syllables. 2. Combine words together to make sentences, with punctuation. 3. Add new random words to the dictionary. Task \#1 will select random syllables from a list stored in an array of Strings. There are rules to this generation, described below. These will be joined together to form a single String containing the generated word. Task \#2 will generate a random number of words, as described below. These will be printed with spaces in between, ending with a punctuation symbol randomly selected from a list. There is one sentence on each line of output. Task \#3 will keep a list of all the randomly-generated words that have been printed, stored using an array. Each word will only be stored in this list once, even if it was generated multiple times. Note that task \#3 can be performed after the words are generated; you don't have to wait until after printing the sentences. Include the following declarations at the start of your program. You may moxify the list of syllables to make your own unique output. Keep the syllable lengths the same; that is, the same mix of two, three, and four-letter syllables. Choose family-friendly sounds. The rules for word generation are as follows: 1. A word has between one and MAXIMUM_wORD syllables, randomly chosen. 2. A single-syllable word can use any of the syllables. 3. A word with more than one syllable is restricted as follows: a. The first syllable can use any of the syllables. b. A syllable can only be the same as the previous syllable if it is two letters long. For example, "wawa' is acceptable but "midmid" is not. c. A word with more than two syllables cannot have more than two syllables that are four (LONG SYLLABLE) letters long. For example, "shimshamfloo' is not a valid word. The length of sentences is based on the value TYPICAL_SENTENCE, using the following calculation: sentenceLength = Math . max ( 1 , (int) ( (new centring the range around TYPICAL_SENTENCE. To use this you will need to import intreductory Computer Stience 2 .mitt your program. The number of words in your gibberish output is chosen by NUM_WORDS. This is the total number of words in all the sentences you generate. Finish your last sentence early, if necessary, to ensure you do not exceed this number of words in your output. The last sentence needs final punctuation too. Here is a partial sample of the output that could be produced by the program, with NUM_WORDS set to 50: Generated sentences : wani roniwa wamid nibo teekmid nibo panni bofloo! shimpan floopan pan ro nifloo midro shambo shim shim? panmidshim wa boshim bobopan! midnisham shambofloo wa sham floo shimni wawaro shimpanbo? shimwamid teekflooro teek shamshimpan? teekshimro wa floo shamni? ro floo teek bo ronifloo shimbo pan wafloo rofloo flooro panmidteek teek bofloo? Dictionary : wani roniwa wamid nibo teekmid panni bofloo .. Notes: - This question can be completed with or without using your own classes and objects, your choice. - Use a partially-filled array to store the generated words. Do not use an Arraylist or any other Java class to store them. - The array will be partially filled. You can determine the maximum possible length from the rules and the number of SYLLABLES. - Do not "sort" the array, add the new words to it in the order that they are generated. - Ensure your solution is separated into functions (at least) for generating words, making sentences, searching the array, and printing the array. You may have more functions if you like. - To generate a random integer between from and to (exclusive) in Java, use the following: (int) (Math. random () * (to-from) + from) It may he a grod idea to put this into a function too

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions