Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nathanl/markov
A Markov chain generator
https://github.com/nathanl/markov
Last synced: 12 days ago
JSON representation
A Markov chain generator
- Host: GitHub
- URL: https://github.com/nathanl/markov
- Owner: nathanl
- Created: 2012-02-26T02:40:40.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2016-07-29T14:45:44.000Z (over 8 years ago)
- Last Synced: 2023-03-11T11:48:40.687Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 37.1 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
# Markov
A simple little Markov chain generator. It constructs fun gibberish, like this, based on the Constitution:
> ...with foreign Powers and to all other, shall be failure the House of President, the Disagree to that the two this Congress of them, or from the People of the absent transmit sealed text is unable cause, without due prohibited States; To establish Justice shall exist within, the supreme Court. The articularly described by a majority of the elected, which shall flee from Arrest during shall have in any State.
That's gibberish based on "what word is likely to come next, based on the input text?" All the words are real, but the phrases are nonsense.
It can also make gibberish based on "what character is likely to come next?" That might look like:
> The United of No Morrow mosterm office President; he United, noon the Senators ander subjection, shall taker supremovalue shall nor it. No States, on of their Afficernment withose, themsel Captural States: but nothe Presidented by two or public Vicer thereof thereof, Tax or, if nor, upon of Revery present a naval juring one form of Senators for, which shall have a Prespection or requalifice of the United as to all inspeech, withorizensation, the Gover in a Qual Stater withirds or, any Triate seaty
In this case, the resemblance to the Constitution is looser: "withose" and "Vicer" aren't real words, but they follow the same sort of patterns as the English in the original. We probably wouldn't see something like "clandinoso" unless the input text was (eg) Spanish.
## Using it
I haven't bothered to make this user friendly yet, as it was just a fun experiment of my own. But you can play with it as follows.
First, you'll need to have Ruby installed.
Then get the code for this project - either `git clone [email protected]:nathanl/markov.git` or download a zip and unzip it.
Next `bundle install` in the directory.
Then you can `ruby ./run_markov.rb`.
Any further customization you want (eg, using something other than the U.S. Constitution as input) will require modifying that script.
## Legal Agreement
You can do whatever you want with this (not that it's very useful), unless what you want to do is create spam, in which case, by using the aforementioned software you do solmenly agree that you will punch yourself in the face 58 times for each spam message you send using text generated by said software, and the punches don't count unless they make you bleed.