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:
Usage
// No need to include the file if working in the browserconst MarkovChain = ; const chain = ; // Create a Markov chain // Teach the chain some text.chain;chain; // Generate a new sentence.console;