Skip to content

thomas-alrek/markov-chain-js

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

About

A Markov Chain generator class for text

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published