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:   

I am Sam I am Sam Sam I am Sam Sam I am Sam Sam I am Sam I am That Sam-I-am That Sam-I-am! I do not like them, Sam-I-am. Could you, would you on a train! Not in a car. And in a tree! Not in a box. And I will eat them anywhere. I would not eat them here or there. I do not like that Sam-I-am Do you like them in a house. Not with a goat! Would you, could you, in the dark! Would you, could you, in the rain. And in the rain. I will not eat them with a mouse. Not with a mouse. I do not like them with a goat. I will try them. You will see. Say! I like them, Sam-I-am. Would you? Could you? in a boat! And I would not, could not, in the rain. And in a box. Not with a fox. I will eat them with a fox? Not in a tree. I would not, could not, would not, on a boat. I will not eat them with a goat? I would not, with a fox I do not like them, Sam, you see. Not in a box. I do mot like them with a mouse. Not with a fox. I will not eat them in the rain. Not in a house. And I would eat them on a train, Not in a boat! And I would not like them here or there. I do not like them in a car. And in the rain. Not in the dark. Not on a train? Not on a boat. I will not eat them here or there. I would not, could not. with a mouse? I do not like them, Sam, you see. Not in a tree. They are