I wrote some python that many of you might appreciate.
Not too long ago I wrote some code to make a Markov Chain from a text and spit out a string of gibberish in the style of said text. This is similar to when you use predictive text to put a string of words together that uses words like you do but doesn’t quite make sense. So… incredibly useful.
Well, I had it read some of my fiction and spit out some phrases, which I posted on the TwitterFace and people seemed to get a kick out of it.
For example, after reading a bunch of my shorts it said (all the punctuation and capitalization were there already, but I did delete some spaces to make them prettier):
- temporarily contemplating if I caught myself to slip into his wormhole theory. When I watched him. Most people
- “Haha!” “I’ll call up Megalos’ pant-leg. Then, a good amount he would make his body. I’m dead in shadows.
- If the woman had killed her seat across the dildo, ominous shadows in love
- One towel and the crap out
And, after reading Moby Dick, it said:
- adieux. Grace being made me. But go to no fear of him; but from foreign seas
- Strange!” holding them in the poet of Elephanta, if ascending the Soloma islands, quite another precautionary motive more I guess.
- New Bedford rose and repose, and rubbing his own sober reason to heighten its perilous contortions be closed eyes
Both sets are obviously nonsense, but they each have a very different feel because they were trained by very different texts. Apparently I am not Herman Melville.
Because people seemed entertained, I decided to clean it up and write a GUI for it. It’s now on Github (Also, I wanted to get some new stuff up on Github because I’m job hunting).
I named it LlamaCat because I wanted a logo for it and had a cartoon I drew a while back of a cat riding a llama into battle… and “Llama Cat” sounds like a thing it would say.
The link to the python code is here: https://github.com/imasillypirate/LlamaCat
If you want to run it with python, you’ll need python 2.7 installed and you’ll need the LlamaCat.gif in the same folder where you plan to execute LlamaCat.py. It will also require a text document (.txt) including the work you’d like it to read. Longer works lead to more interesting results, but they can take a while.
If you’re on a Windows machine, you can download the .zip file instead which contains an executable and everything you should need, aside from the text document.
You can find the .zip file here: https://www.dropbox.com/s/fcieyjfqbcu0dda/LlamaCat.zip
Just unzip the file, then open the directory and double click LlamaCat.exe… If your antivirus lets you launch a .exe written by some random pirate on the internet, then you should be fine.
A great source of texts is Project Gutenberg: https://www.gutenberg.org/
You’ll want the plain text version of whatever book you pull down.
Go ahead and play with it. Feel free to let me know if you have questions, comments, or if it says something particularly funny (or creepy)!