markov-chain-js
v1.0.2
Published
A Markov Chain generator class for text
Downloads
6
Readme
MarkovChain
This is a JS implementation of a Markov Chain text generator.
It can be used for implementing name generators, placeholder text and more.
See the documentation for detailed instructions.
If you want to contribute, please check out the contribution guide.
Installation
If you are running in a node environment, you can install the pacakge from NPM.
npm install markov-chain-js
If you just want to use it standalone, you can use the compiled and minified version in dist.
Usage
const MarkovChain = require('markov-chain-js')
const options = {
source: `Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Integer nec odio.
Praesent libero.
Sed cursus ante dapibus diam.
Sed nisi.
Nulla quis sem at nibh elementum imperdiet.`,
order: 3
}
let myGenerator = new MarkovChain(options)
myGenerator.generate() // Outputs e.g: 'Sed nibh element libero'
Licensed under the MIT license.
Copyright Thomas Alrek © 2017