Markov.js is a JS library to process Marcov chains. Currently it supports single order markov chains, and accepts then processes input in string or array form. Currently it can only output arrays.
- Include Markov.js
markov.read(input)
will process your input array and store the first order markov analysis.markov.read(length)
will return an output of the specified length generated from the markov analysis.
This 1000 word output was generated based on Shakespeare's A Midsummer Night's Dream. Sadly, Iambic Pentameter was not preserved. Maybe with a couple more orders it would be to an extent.
mountains turned into a bank whereon the red rose up from the flood;
When we must play Pyramus.
BOTTOM
Well, I will roar that fire I must be sung
When his revels are Hermia's: will roar that she respects me cause to say
what dream it doth hop:--
Hit with fair Helena! Nature shows art,
That through the fairy favours,
So awake when she durst not use a worthy gentleman.
HERMIA
So is here!
Of colour like two neighbours.
DEMETRIUS
No remedy, my dream was with an Athenian's eyes:
And so proud
That they shall see the wood where we shall be
written in her behalf that way let him of Athens look thou dost not know,
Lest, to enter into a watery glass,
Decking with eglantine:
There sleeps Titania be but more than all my part;
And yours of the moon, for love with Helena,
To do quake and she, as fairly rank'd,
If not too officious
In her Train.]
OBERON
Well, go with liquid pearl in silence yet a prologue; and help from my finger, I fear lest day is he would;
Or on in the winds, piping to hear
without warning.
HIPPOLYTA
This is down and myself will wed thee injuries;
But I from each word a false Trojan under each. A room in my enterprise
That I have ever cross'd,
It stands as other love, so bright? Not with Theseus, our stamp here, with my love, so in revenge, have heard so oft made sport;
And, like Thessalian bulls;
Slow in a cough;
And then the honey-bag. Do I am as well be all three
To fashion this long age of man holding no wound.
Lysander, if thou seest these that did lose it.--But, Demetrius, as one come in my daughter Hermia.--
Stand forth, Demetrius.--My noble lord,
It is mended,--
How came last a sweet air
More tuneable than e'er played on sleeping Hermia? No: I will find immediately.
[Exit.]
ACT III.
SCENE I. Athens. A wood go, I in the wane: but I have his qualities.
Things base and our
devices known. In their leathern wings,
To make amends ere he come home yet?
STARVELING
He cannot meet at one player fitted:
And tragical, my dear;
Which is--no, no--which was never holla'd to, nor look in their minds till morrow deep midnight.
LYSANDER
I will, fair Hermia, question your will;
For in Helena.
DEMETRIUS
Follow! nay, to prove an ass if I trusty sword;
Set your counsels; never heard
So musical confusion
Of hounds and might
To honour Helen, till the pretty and TITANIA, with triumph, and all the sharp Athenian youth to love shall see a god;
One that fire I perceive you long-legg'd spinners, hence;
Which Lion hight,
The trusty still.
THISBE
And I did I pray you, if the world;
Unless you may effect this will roar that lies in her to this keen mockery born?
When at the lantern; for aye to go?
HERMIA
What love shall it be to you,
Bearing the ground.
[Exeunt. Horns sound within.]
[Enter THESEUS, HIPPOLYTA, EGEUS, DEMETRIUS, LYSANDER,HERMIA, and here's a tyrant: I beg a wall.--What say we are things shall know thy light!
Now die, die, die, but to the time.
LYSANDER
Proceed, moon.
MOON
All that joy;
Or in a mouse
So, good Peter Quince.
QUINCE
Robin Starveling, the death, or bear,
Pard, or history,
The course of the worst
are no more whether thou hast stol'n my life.
THESEUS
A very tragical mirth.'
Merry and fetch thee employ,
I'll to take it would give his eyes;
Feed him imprinted, and HERMIA.]
OBERON
Stand close; this comedy of thorn,
But mark,--poor knight,
Shall upon him; lead these things unknown, the moon; but, oh, methinks, being young, till now;
And now you do,
But you grown so live, good night, O happy is Pyramus? a word:--
Thorough bush, thorough fire,
And this dream: it is this,
Sweet love?
LYSANDER
I speak as
small as other slayeth me.
Thou told'st me with me.
I know what should not. 'Deceiving me' is
Thisby's cue: she do set aside.--
Away with him.--
And are that costs the door.
[Enter OBERON at our intent
Was to one, and grunt, and me, so bright? Not with pretty and bid us every turn.
[Exit.]
BOTTOM
Why do I will have his sight away the governess of your stealth unto hell!
LYSANDER
Helen, to my love ne'er alter till now;
And now will hear the city, and Train.]
LYSANDER
How now, my part of it home yet?
STARVELING
He cannot be sung
O long for him; lead them there.
FAIRY
Either I am here.
DEMETRIUS
Nay, then, we go?
TITANIA
Be kind are left sweet jest to wrap a mispris'd mood:
I am I trusty Thisby, tarrying in the dead or spangled starlight sheen,
But they shall hear that I mistake your father. Good Master of high respect with the Athenian garments he did love have I will roar again.'
QUINCE
An you gone: who would he cry 'cuckoo' never did mockers waste more strength than myself,
That I betroth'd ere I never holla'd to, nor scar,
Thorough flood, thorough this place.
[Song and methought I love said to kill himself:
Which when the coming from this you dwarf;
You minimus, of Venus' doves,
By that do nothing impaired, but with their elves coats; and brief!
That is mine eye,
Is only son.
There, gentle hearts do appear.
PUCK
I go, I will of my daughter here comes Helena.
[Enter HELENA.]
HERMIA
God speed fair Hippolyta, our swords, and grunt, and LION, as truest horse, that same cowardly giant-like ox-beef hath strong imagination,
That, if they have heard of. Out of that: that lies in the lie, though you leave here to churchyards: damned spirits all,
That in my heresy,
Of all this kind are ripe;
Make choice of spirits; I'll slay, the middle summer's spring,
Met we ought to pass,--
Titania wak'd, and so
every one bed, two more; let loose,
Or I weep; and with Lysander.
HELENA, in a mouse
When truth appears.
How can no farther. Let me see thy dear.
[Enter HERMIA.]
HERMIA
Dark night, O night, imagining some enforcèd chastity.
By an ass.
OBERON
There lies in a mouse
Never excuse; for your apparel together; good Demetrius, come;
And come, come;
CHORUS.