A simple implementation of a markov chain algorithm for generating nonsense text and words from books.
Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README
markov.py
sherlock.txt

README

/*****************************************************************/
This code is terrible! My apologise.
It does some mangling of the text input to remove newline 
characters and a few other bits and peices.
It judges the end of a sentence to be when the last word generated
ends with a full stop.
I should have done something clever to force it to use a pair of 
words that are actually at the start of a sentence when randomly 
selecting a pair for a new sentence. I shall leave that as an 
exercise for the reader ;)

Matt

#Improvments added by Finn - Gentleman&Scholar
#http://matthewshotton.wordpress.com/2011/02/23/clothed-all-in-the-morning-you-know-by-the-river-a-lite-introduction-to-markov-chains-and-nonsense/#comment-58



p.s the included sherlock holmes file is in the public domain, so i 
assume it is free to distribute. The file was originally downloaded
from the awesome project gutenberg. The small print said it was cool 
to redistribute it so long as all the small print and references to 
project gutenberg in the file were removed......i'm not sure if i'm 
doing it right.....will gladly change things if i'm not, just shoot 
me a message.....or DMCA takedown if you wanna be like that.

/*****************************************************************/
License
/*****************************************************************/
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

/*****************************************************************/













If you are reading this, you have read too far ಠ_ಠ