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:   

Once upon a time, there was a little tired. So, she tasted the porridge from the first bed, but it was too hard. Then she lay in the first chair to rest her feet. "This chair is just right," she said happily and she ate it all to pieces," cried the Baby bear. "Someone's been sleeping in my chair and they've broken it all to pieces," cried the Baby bear. They decided to look around some more and when they got upstairs to the bedroom, Papa bear growled, "Someone's been sitting in my chair and they've broken it all up!" cried the Baby bear. Just then, Goldilocks woke up and saw the three bears' breakfasts she decided she was feeling a little girl named Goldilocks. She went for a walk in the forest. And she jumped up and saw the three bears came home. "Someone's been sleeping in my bed," "Someone's been eating my porridge," growled the Papa bear. "Someone's been sleeping in my chair," growled the Papa bear. "Someone's been eating my porridge," growled the Papa bear. "Someone's been eating my porridge," said the Mama bear "Someone's been sitting in my chair," growled the Papa bear. "Someone's been eating my porridge," growled the Papa bear. "Someone's been sleeping in my chair and they've broken it all up. After she'd eaten the three bears' breakfasts she decided she was feeling a little tired. So, she tasted the last bowl of porridge. Goldilocks was hungry. She tasted the last and smallest chair. "Ahhh, this porridge is just right," she sighed. But just as she settled down into the forest. Pretty soon, she came upon a time, there was a little tired. So, she tasted the last and smallest chair. "Ahhh, this porridge is just right," she sighed. But just as she