JSMarkov is a simple javascript library for Markov text generation based on word-level trigraph models that we’re releasing under an MIT license.
With JSMarkov you can generate random text in the style of Moby-Dick:
Ah! how cheerfully we consign ourselves to perdition! Finally, I do not enjoy themselves much, as every one knows, meditation and water are wedded for ever. But wherefore it was that after having repeatedly smelt the sea as a sailor, I thought I would sail about a little and see the mummies of those creatures in their huge bake-houses the pyramids. No, when first told that you see the mummies of those creatures in their degree, some time or other, cherish very nearly the same time that the leaders little suspect it. Besides, passengers themselves must pay. And there they stand—miles of them—leagues. Inlanders all, they come from lanes and alleys, streets and avenues—north, east, south, and bringing up the rear of every kind whatsoever. It is a damp, drizzly November in my purse, and in the air.
Or Alice’s Adventures in Wonderland:
So she set to work, and to her very earnestly, ‘and see whether it’s marked “poison” or not’; for she had not noticed before, and noticed that they were all locked; and that if you cut your finger VERY deeply with a knife, it usually bleeds; and if it makes me grow larger, I think I could, if I fell off the cake. * * * * * ‘What a curious feeling!’ said Alice to herself, rather sharply; ‘for it flashed across her mind that she ought to have wondered at this, I shall have to ask: perhaps I shall fall right THROUGH the earth! How brave they’ll all think me at home! Why, there’s no use now,’ said Alice to herself, ‘and if it makes me grow smaller, I shall think nothing of tumbling down stairs! How brave they’ll all think me at home! Why, I think I could, if I fell off the top of her head to feel which way it was good practice to say it over) ‘—but then I wonder if I only knew how to begin.’ For, you know,’ she said, ‘Oh dear! Oh dear! I think—’ (for, you know. Please, Ma’am, is this New Zealand or Australia?’ for, you see, so suddenly that Alice had no pictures or conversations in it a very deep, or the key was too dark to see it pop down a large rabbit-hole under the hedge.
Then the wild and distant seas where he rolled his island bulk; the undeliverable, nameless perils of the doors of the doors of the earth! How funny it’ll seem to come out among the people that walk with their heads downward! The Antipathies, I am in the habit of going to do THAT in a game of croquet she was now the right size for going through the doorway; ‘I must be shutting up like a tunnel for some way, and Alice’s first thought was that after having repeatedly smelt the sea as a sort of officer on ship-board—yet, now that I recall all the circumstances, I always go to sea as soon as I can. This is my substitute for pistol and ball. With a philosophical flourish Cato throws himself upon his sword; I quietly take to the ship. There was nothing so VERY remarkable in that particular instance? Who ain’t a slave? Tell me that. Well, then, I should now take it into one of the whale; these, with all the difference in the stream. There seemed to be seen: she knelt down and looked at the same feelings towards the ocean with me.
Or you can parody political figures:
Look, having nuclear—my uncle explained that to me many, many years ago, the white belt of wampum was the deepest pledge of honour; though in other mortal sympathies and symbolizings, this same hue is made the emblem of many touching, noble things – the innocence of brides, the thing that really bothers me—it would have been so easy, and they, they don’t, they haven’t figured that the women are smarter right now than the men, so, you know I have to give my like credentials all the time, because we’re a little disadvantaged—but the Persians are great negotiators, so, you know, it’s gonna take them about another 150 years—but the Persians are great negotiators, so, and the modern kings of Siam unfurling the same imperial hue; and the great Austrian Empire, Caesarian, heir to overlording Rome, having nuclear—my uncle was a great professor and scientist and engineer, Dr. John Trump at MIT; good genes, very good genes, OK, very smart, the power of what’s going on with the four prisoners—now it used to be three, now it’s four—but when it was three and even now, I would have been so easy, and it is fellas because, you know, they don’t, they just killed us.
What will you do with it?
Get it here https://github.com/counterwave/jsmarkov and give it a try yourself.