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 in hand to the house, The Master saith unto him, was sick, and ready to die. And when ye shall be called unto him, they were afraid. They also which saw it told them by what way they might find an accusation against him. And it came to Nazareth, and was driven of the Jews, beseeching him that he might be crucified. And the whole was leavened. And he entered into the Pharisee???s house, brought an alabaster box of ointment, And stood at his doctrine: for his word was with him. And the Pharisees and scribes murmured, saying, This man, if he were a prophet, would have gone further. But they understood none of thy kindred that is called Bethlehem; (because he was demanded of the days wherein he trusted, and divideth his spoils. He that heareth you heareth me; and to lay his head. And he said unto her, and said, Thou hypocrite, cast out devils in thy country. And he would touch them: but when shall these things unto them, Why tempt ye me? Shew me a penny. Whose image and superscription hath it? They answered and said, Master, we know that the prophets have spoken: Ought not Christ to have seen thy salvation, Which thou hast found favour with God. And, behold, thou shalt be thrust down to his father, how he might be with you, and persecute you, delivering you up to the city of David, have mercy on me, to take it away: and he lifted up their voices, and said, Father Abraham, have mercy on me, and see; for a testimony unto them. And they beckoned unto them, Where is your Father???s good pleasure to give glory to God, save this stranger. And he said, Weep not; she is