2.0.3 • Published 4 years ago

purpl-markov-chain v2.0.3

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

Markov Chain

A simple Marvkov chain class supporting different n-grams, back and forth generation and serializable to JSON or string in order to save them and reload them later.

Documentation

The documentation is available here.

Installation

  • For use in npm, run the command:

npm install --save purpl-markov-chain.

  • For use in the browser, you can include the library from a CDN:
<script src="https://unpkg.com/purpl-markov-chain/index.js"></script>
<script>
  const chain = new MarkovChain();
</script>

Usage

// No need to include the file if working in the browser
const MarkovChain = require('purpl-markov-chain');

const chain = new MarkovChain(); // Create a Markov chain

// Teach the chain some text.
chain.update('Adding some sentences');
chain.update('And more uwu');

// Generate a new sentence.
console.log(chain.generate());
2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago