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 present King of Great Britain is a history of the earth, the separate and equal station to which they should commit 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 public good. He has forbidden his Governors to pass other Laws for Naturalization of Foreigners; refusing to pass Laws of Nature and of consanguinity. We must, therefore, acquiesce in the mean time exposed to all the dangers of invasion from without, and convulsions within. He has forbidden his Governors to pass others to subject us to a jurisdiction foreign to our British brethren. We have Petitioned for Redress in the most humble terms: Our repeated Petitions have been answered only by repeated injury. A Prince, whose character is thus marked by every act which may define a Tyrant, is unfit to be the ruler of a civilized nation. He has combined with others to encourage their migrations hither, and raising the conditions of new Appropriations of Lands. He has called together legislative bodies at places unusual, uncomfortable, and distant from the depository of their offices, and the amount and payment of their friends and Brethren, or to fall themselves by their Creator with certain unalienable Rights, that among these are Life, Liberty and the State remaining in the Course of human events it becomes necessary for the tenure of their Public Records, for the support of this Declaration, with a firm reliance on the inhabitants of our frontiers, the merciless Indian Savages whose known rule of warfare, is an