Skip to content
A Markov Chain generator class for text
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
src
.babelrc
.editorconfig
.eslintrc.js
.gitignore
CONTRIBUTING.md
DOCUMENTATION.md
LICENSE
README.md
package.json
webpack.config.js
yarn.lock

README.md

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

You can’t perform that action at this time.