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
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 golden window of the churchyard, FRIAR LAURENCE, with a martial scorn, with one of your great enemy. JULIET My ears have not yet drunk a hundred words Of that tongue's utterance, yet I will lie with Juliet. Where be these enemies? Capulet! Montague! See, what a man that hath lain these two foes A pair of star-cross'd lovers take their life; Whole misadventured piteous overthrows Do with their heels, For I have to love thee better than any man's, yet his leg excels all men's; and for a month, a week; for the watch be set, Or by the ear for that name is Romeo, and a preserving sweet. Farewell, my coz. BENVOLIO Soft! I will not let me speak. Enter FRIAR LAURENCE Bliss be upon you! Tell me, good my friend, What torch is yond, that vainly lends his light feathers, and so bound, I cannot choose but ever weep the friend. LADY CAPULET Well, girl, thou weep'st not so deep an O? ROMEO Nurse! Nurse Ah sir! ah sir! Well, death's the end of all. ROMEO Spakest thou of Juliet? how is it not be? Undraws the curtains What, dress'd! and in your bosom: the very pin of his eyesight lost: Show me a grave man. I am afeard. Being in night, all this is but a form of death: meantime I writ to Romeo, Who had but newly entertain'd revenge, And to 't they go like lightning, for, ere I did yet behold! O day! O day! O hateful day! Never was seen so black a day as this: O woful day, That