What is this?
One night I was bored. So, like any intellectually curious, red blooded American, I thought to myself
What’s Jeb Bush up to?
So I thought, why not use the resulting text to train a Markov bot and put it online? This is the code that generated the content which is being posted on Twitter.
I asked the bot if it had any plans to run for president, it replied (emphasis added):
So, as you can see, it’s keeping it’s options open.
How do I use it
You’ll need Scala and Ruby. You’ll also need to download and unpack the pst files from Jeb’s website.
Building the Scala Library
Scala is used to parse the pst files and output a text file. To build the jar file use the following command:
This project uses ruby, so you’ll need to bundle:
You interact with the library using a command line application (Thor app).
You can find all the from addresses in the pst files using the following command:
If you want to find the most email addresses that appear the most frequently in the from address, use the following command:
Now, it extract the bodies, use the following command:
Next, you can build the model:
And finally, you can generate some sentences:
Buffer your responses
I use buffer to post to twitter at regular intervals. You will need your buffer token, which is left as an excercise for the user.
First, you can get the profile ids of the accounts you’d like to post to:
Next, given the
sentences.txt file we generated before, buffer those sentences to two buffer profiles:
That’s it, you’re Markov bot is now live.