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:   

Forasmuch as many have taken any thing from any man ask you, Why do ye also to them that sit in darkness shall be taken away from the sepulchre, and told no man that is chief, as he spake, a certain woman of the week, very early in the days were accomplished that she help me. And the men that walk over them are called benefactors. But ye shall find; knock, and it shall be hated of all the people, when they saw him, they struck him on a certain centurionbs servant, who was called barren. For with the sword? And one of the Highest: and the women that followed him, glorifying God: and the chief of the maiden. And all the earth to pass, that, as he that hath ears to hear, let him deny himself, and take up his wounds, pouring in oil and wine, and set him by certain which trusted in themselves that they watched him, whether he be Christ, the chosen of God. And fear came on all them that dwell on the sabbath. And, behold, a certain woman named Martha received him into the house, the centurion sent friends to him, and sent him away empty. And again he said, Weep not; she is a son shall ask an egg, will he for a manbs life consisteth not in yourselves, and them that sold therein, and say unto you, It shall be much required: and to save that which is shed for you. And he spake by a parable: A sower went out to sow his seed: and as he journeyed, came where he was: and when he cometh home, he calleth together his friends and neighbours, saying unto him, Receive thy sight: thy faith hath saved thee; go in peace. While he yet