DOC PREVIEW
Stanford CS 106B - The CS106B Random Writer Contest

This preview shows page 1 out of 3 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Eric Roberts Handout #14CS106B April 10, 2009The CS106B Random Writer ContestDue date: Monday, April 20On Assignment #2, the second problem has you create a random-writer application thatuses a Markov model to generate English text according to a pattern. Figure 1, forexample, shows the output generated by two runs of the program (slightly shortened andreformated so that the figure fits on one page), one that uses Middlemarch as its text andone that uses Hamlet. The styles are instantly recognizable as that of George Eliot andWilliam Shakespeare. Moreover, the names of the characters make it clear what storyserved as the model. As impressive as the similarities are, however, there is still onemajor problem: the stories don’t make any sense at all.Your job for this contest is to submit a randomly generated text of not more than 2000characters, along with the program and data files used to produce it. What we’re lookingfor is the best story, poem, play, or other “literary” work. To produce it, however, you’llprobably have to do some serious thinking about the design of the program. There aremany ways you can extend the program to make it more likely to produce something thatbetter than the simple Markov model approach used in the assignment, including thefollowing:• Change the program so that the basic unit is a word rather than a character. Makingthis change will certainly produce more sensible stories, but does have pitfalls of itsown. For one thing, the corpus of text you supply probably has to be much larger ifyou hope to have your output differ substantially from the input you supply. Thecomplete works of Shakespeare, for example, would be a better starting point for aplay-writing program than Hamlet alone. It will probably also be necessary to reducethe order of the model or to use a more complicated approach for choosing the nextword than the simple Markov approach.• Add additional code to make increase syntactic and semantic consistency. You are notrequired to stick with the basic Markov model used in the assignment and are free toextend your program in any way you want (subject to the rules described on the lastpage of this handout). It is, for example, a bit unnerving to have open quotation marksthat are never closed. You could fix that by insisting on generating matching quotationmarks. Semantic consistency is harder to obtain, but you could, for example, add codeto ensure that the lines delivered by characters in the Shakespeare example are in factdelivered by characters who are on the stage. This change would eliminate, forexample, the disconcerting situation of having Hamlet address Horatio after the stagedirection “[Exeunt all but Hamlet]”.• Add any features you want to enforce a particular form. If you want your programs towrite sonnets in the Shakespearean mode, for example, you are allowed to ensure thateach sonnet has fourteen lines and to try (although doing so is subtle) to countsyllables to approximate iambic pentameter. Similarly, if your program is writing aplay, you can include speaker tags as part of your general formula for generating text.And you should not feel constrained to have your program produce its output withprecisely the right spacing. You are free to modify the formatting (as I did for theexamples in Figure 1) to change the line breaks or regularize the spacing. Yourprogram must simply produce the same stream of characters other than whitespace thatyou submit as your entry.– 2 –Figure 1. Random writer examples using Middlemarch and Hamlet as sources Non si pub dicer, ne tener a mente, And builds a heaven in hell's despair.Thus he had consisted at that time if Mary Garth, who appeared the more keenly he felt that he wouldsometimes it upset her gravity, "if you think of something for her flightiness, and did mischief whenthey're sorry," said Caleb, turning from useless words.Neither of them knew how to use the preparations for me," said Dagley. "I can think of that childishkisses which were most in need of praise. He spoke to Miss Vincy.Celia, in her cooing way, keeping here.""Oh ay, they stick, do they? and the rest, without seeming nearer. There are so many things mayhappen," said Fred, who felt himself plodding along the edges, caused the pick of them; and if there hadbeen urged. His sense of connections. That is a point I wanted up-stairs, poor dear old soul. A manwhose learning. But my children in Middlemarch politics generally done something important stepwithout capital practice did him in counteracting me secretly in future--not in future, you know. Garth hasinvented a new pattern of mittens?"After the fashion."No, I only sketch a little grumbling remonstrated with his own account. Her friends. Take your brotherwith a still deeper undertone in which dominated them--the painter is not known of Raffles had sustainedher point of view, as well as on all other subjects a kind of thing. He only neglects his work only: that wasleft. I thought you only cares about Mrs. Goby. You have not the sample of virtue or accomplishmentsin the House had been tinkering long enough to bear up at Fair time, if I didn't mean beating, you know." Enter young Osric. Cousin Hamlet? Ham. Not this, by no means! Ham. I pray you. Guil. We will, we will! Laer. I thank your lordship were at leisure, I should impart a thing to you from his mouth whose voice will draw both friend and foe, Winner and loser? Laer. Must there no offence i' th' world. King. Thanks, dear my lord. [Exeunt all but Hamlet.] 'Tis too much o'erleavens To wash it white as snow, thou noble youth, Have heaven? But let it be. Horatio, I am dead; Thou canst not then be false to any man. That's an ill phrase, a vile phrase; 'beautified' is a vile phrase. But you'll be secret? Both. Arm'd, my lord, put your discourse most eloquent music. Look you lay home to him. [Leaps in after Laertes. Laer. O, fear me not! [Polonius]. Guil. My honour'd lord, 'tis true. A foolish figure! But now, my cousin Hamlet? Ham. Nay, but to live Without the which he has impon'd, as you say, my mother. Exit. King. We doubt it is no matter in his heart, Absent thee from felicity awhile, And reason panders will. My stronger than a mason, a


View Full Document

Stanford CS 106B - The CS106B Random Writer Contest

Download The CS106B Random Writer Contest
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view The CS106B Random Writer Contest and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view The CS106B Random Writer Contest 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?