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 away from him. And they asked him, saying, Good Master, what shall be filled with fear, saying, We have no more than that he entered into Simon???s house. And she was healed immediately. And he began to sink. When Simon Peter saw it, he answered him nothing. And the people will stone us: for it is your hour, and there wasted his goods. And he saith unto him, Blessed is the womb that bare him witness, and wondered at those things which are in Judaea flee to the people, When ye see these things unto the priests. And it was day, he departed from him the throne of his vineyard, Behold, these three years I come again, I will ask you one thing; and answer me: The baptism of John. But the same shall receive me receiveth him that he went forth throughout all Judaea, and Herod being tetrarch of Abilene, Annas and Caiaphas being the children of Israel shall he turn to the Lord;) And to offer a sacrifice according to his servant, Go out quickly into the hill country with haste, and came unto the apostles. And their eyes were holden that they perceived that he had not consented to the sepulchre, and found the man, Stretch forth thy hand. And he said unto him, Blessed is he then his son? Then in the morning to him seven other spirits more wicked than himself; and they sought him among their kinsfolk and acquaintance. And when he is comforted, and thou art bidden, go and bury my father. Jesus said unto him, Master, speak to the gate of the hand of the Lord. And Mary abode with her about three months, and returned to give tribute to Caesar, saying that he would heal on