Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seishun/mark
A basic Markov chain implementation for text generation for Node.js
https://github.com/seishun/mark
Last synced: 19 days ago
JSON representation
A basic Markov chain implementation for text generation for Node.js
- Host: GitHub
- URL: https://github.com/seishun/mark
- Owner: seishun
- Created: 2012-10-15T16:32:38.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2012-10-16T21:33:33.000Z (about 12 years ago)
- Last Synced: 2024-10-18T19:42:34.248Z (26 days ago)
- Language: JavaScript
- Size: 106 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Mark
====A basic Markov chain implementation for text generation for Node.js
Markov.py port (part of the Talho project https://github.com/eurekafag/Talho/blob/master/modules/markov.py)
## How to use
```js
var markov = new (require('mark'))('mongodb://user:[email protected]:port/db');
```Adding words:
```js
markov.addWords(string, callback);markov.addWords('The quick brown fox jumps over the lazy dog', function(result){
//callback function for error handling
});
```
You must feed it full sentences for best results.Building chain:
```js
markov.buildChain(length, callback);markov.buildChain(10, function(result){
//callback function that will display or handle result
});
```