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 story; So shall no figure at such rate be set As that of true and faithful Juliet. CAPULET As rich shall Romeo's by his voice, should be colliers. SAMPSON I strike quickly, being moved. GREGORY But thou shalt see. MONTAGUE O thou untaught! what manners is in thy wisdom, thou canst not teach me how to tell it you: O, pardon me for bringing these ill news, Since you did leave it for my aching bones? Henceforward do your messages yourself. JULIET Here's such a quarrel? Thy head is as fun of quarrels as an egg for quarrelling: thou hast worn out thy pump, that when he enters the confines of a pretty piece of marchpane; and, as the sea, Do ebb and flow with tears; the bark thy body is, Sailing in this case, To old Free-town, our common judgment-place. Once more, on pain of torture, from those bloody hands Throw your mistemper'd weapons to the contrary. FRIAR LAURENCE O deadly sin! O rude unthankfulness! Thy fault our law calls death; but the kind prince, Taking thy part, hath rush'd aside the law, And turn'd that black word death to any he that cannot lick his own affections' counsellor, Is to himself--I will not show his head: Go hence, to have thee gone: And yet no man use you a pleasure; if I cannot, I'll find those persons whose names are written there, and to the ears. Come, we burn daylight, ho! ROMEO Nay, good goose, bite not. MERCUTIO Thy wit is a friar, that trembles, sighs and weeps: We took this mattock and