Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brianhicks/markov-generator
a simple gibberish / random text generator using a markov chain.
https://github.com/brianhicks/markov-generator
Last synced: about 2 months ago
JSON representation
a simple gibberish / random text generator using a markov chain.
- Host: GitHub
- URL: https://github.com/brianhicks/markov-generator
- Owner: BrianHicks
- Created: 2010-08-20T16:44:49.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2010-08-20T16:52:43.000Z (over 14 years ago)
- Last Synced: 2024-05-09T07:09:28.772Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 105 KB
- Stars: 20
- Watchers: 4
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Markov Text Generator
=====================Why?
----Because to understand markov chains I needed to hack something together. And to be honest, it produces some pretty interesting little stories, given the right input.
How?
----After including json2.js and markov.js in your page...
var test = new markov(text, type, regex);
The text can be anything you so desire.
The type should be "string" or "json".
And the regex should always be global. All matches are used.Methods
-------to generate a phrase of a given length:
test.gen(length);
to see the object containing the data:test.data;
to get the JSON generated by JSON2.js of the data:test.getJson();
A warning though, you probably only want to use the JSON for making things a bit faster on the processing end with long text, as the JSON tends to be an order of magnitude greater in file size than the input text.Copyright
---------This is all open source, you can use it however you like. Especially to learn.
That said, I would enjoy it if you would send me a sample to work produced by this.
Oh, and JSON2.js isn't mine, the source can be found at http://www.json.org/json2.js