Babble

This was originally a project for a data structures and algorithms course.

Input a reasonably long chunk of text and press Babble to get your result. The aim of this simple program is to produce an output that makes semi-grammatical sense at first glance, but doesn't make much logical sense when you actually try reading it. More text is always better; use at least a paragraph for best results. Song lyrics can often produce amusing results.

The "Babbliness" factor determines how closely the output will match the input. Output with a Babbliness value of 5 will not resemble the input very much at all and will probably not make much grammatical sense, while output with a Babbliness value of 1 will make good grammatical sense but possibly be nearly identical to the input text.


Sample inputs: Green Eggs and Ham   Goldilocks and the Three Bears   Still Alive   Declaration of Independence   Gospel of Luke   Romeo and Juliet   



Babbliness:    Output length:   

ACT I PROLOGUE Two households, both alike in dignity, In fair Verona, where we lay our scene, From ancient grudge break to new mutiny, Where civil blood makes civil hands unclean. From forth the parties of suspicion. FRIAR LAURENCE On Thursday, sir? the time and place Doth make against me of fear! FRIAR LAURENCE There on the earth doth live But to the day, O, now I see this one is one too much, Which mannerly devotion shows in this; For saints have hands that pilgrims' hands do touch, And palm to palm is holy palmers' kiss. ROMEO Have not saints lips, and holy physic lies: I bear no hatred, blessed man, for, lo, My intercession likewise steads my foe. FRIAR LAURENCE Wisely and slow; they stumble that run fast. Exeunt SCENE II. A street. Enter ROMEO, MERCUTIO, BENVOLIO, with five or six Maskers, Torch-bearers, and others PRINCE Where are the children of an unmade grave. Knocking within FRIAR LAURENCE What's here? a cup, closed in a month. Nurse An honour! were not I thine only nurse, I say! madam! sweet-heart! why, bride! What, not a word with one hand beats Cold death aside, and with the Capulets! down with the terror of the old bench? O, their bones, their bones! Enter ROMEO ROMEO Father, what news? what is the fairies' midwife, and she comes from shrift with merry look. Enter JULIET JULIET The clock struck nine when I did yet behold! O day! O day! O day! O hateful day! Never was seen so black a day as this: O woful time! CAPULET Death, that hath a hair more, or shall I believe That unsubstantial death is as a bell, That warns my old feet stumbled at graves! Who's there? BALTHASAR Here's one, a friend, and one that knows