Skip to content
Markov chains in inefficient JS.
JavaScript HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Markov In Inefficient JS

View public_index.html for a sample.

These chains are generated with two independent dictionaries of 2-grams and 3-grams. Sentences are split into words and these words are used to index the following words. For instance, the following sentences:

to be or not to be that is the question

...would be recategorized as:

to: ['be', 'be']
be: ['or']
or: ['not']
not: ['to']
that: ['is']

Note that the duplicated be's are intentional; a random index in the to array can then be used to pick a next word, weighted for probability.

3-grams are indexed as:

'to be': ['or']
'be or': ['not']

and so on.

It's horribly inefficient, but... So sue me.

More information here.

You can’t perform that action at this time.