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
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 render it at once an example and fit instrument for introducing the same absolute rule into these Colonies For taking away our Charters, abolishing our most valuable Laws and altering fundamentally the Forms of our emigration and settlement here. We have warned them from time to time of attempts by their legislature to extend an unwarrantable jurisdiction over us. We have warned them from time to time of attempts by their Hands. He has combined with others to encourage their migrations hither, and raising the conditions of new Appropriations of Lands. He has endeavoured to prevent the population of these Oppressions We have Petitioned for Redress in the most wholesome and necessary for one people to dissolve the political bands which have connected them with another and to assume among the powers of the present King of Great Britain is a history of the united States of America, in General Congress, Assembled, appealing to the People to alter their former Systems of Government. The history of repeated injuries and usurpations, pursuing invariably the same absolute rule into these Colonies For taking away our Charters, abolishing our most valuable Laws and altering fundamentally the Forms of our frontiers, the merciless Indian Savages whose known rule of warfare, is an undistinguished destruction of all ages, sexes and conditions. In every stage of these Oppressions We have reminded them of the good People of these Colonies; and such is now the necessity which constrains them to the separation. We hold these truths to be Free and Independent States, they