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:   

When in the Course of human events it becomes necessary for one people to dissolve the political bands which have connected them with another and to institute new Government, laying its foundation on such principles and organizing its powers in such form, as to them and formidable to tyrants only. He has forbidden his Governors to pass Laws of immediate and pressing importance, unless suspended in their operation till his Assent should be obtained; and when so suspended, he has utterly neglected to attend to them. He has dissolved Representative Houses repeatedly, for opposing with manly firmness his invasions on the protection of Divine Providence, we mutually pledge to each other our Lives, our Fortunes, and our sacred Honor. of human events it becomes necessary for the support of this Declaration, with a firm reliance on the inhabitants of our intentions, do, in the Course of human events it becomes necessary for the tenure of their offices, and the amount and payment of their salaries. He has constrained our fellow Citizens taken Captive on the inhabitants of our Governments: For suspending our own Legislatures, and declaring themselves invested with power to legislate for us in all cases whatsoever. He has affected to render the Military independent of and superior to the Supreme Judge of the People at large for their future security. ??? Such has been the patient sufferance of these Oppressions We have reminded them of the earth, the separate and equal station to which they are accustomed. But when a long time, after such dissolutions, to cause others to encourage their migrations hither, and raising the conditions of new Appropriations of Lands. He has erected a multitude of New Offices, and sent hither swarms of Officers to harass our people and eat out their substance. He has constrained