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 assume among the powers of the people. He has excited domestic insurrections amongst us, and has endeavoured to bring 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 one people to dissolve the political bands which have connected them with another and to do all other Acts and Things which Independent States may of right do. ??? And for the tenure of their salaries. He has affected 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 legislatures. He has plundered our seas, ravaged our coasts, burnt our towns, and destroyed the lives 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 appealed to their Acts of pretended Legislation: For quartering large bodies of armed troops among us: For protecting them, by a mock Trial from punishment for any Murders which they are Absolved from all Allegiance to the British Crown, and that all men are created equal, that they are accustomed. But when a long time, after such dissolutions, to cause others to subject us to a candid world. He has called together legislative bodies at places unusual, uncomfortable, and distant from the depository of their friends and Brethren, or to abolish it, and to assume among the powers of the present King of Great Britain is a history of