sadface-bot: A Markov chain bot

Markov bots make for amusing text generators. They don’t make much sense, usually. When they do make sense, it’s pure chance.

sadface draws its vocabulary and concepts from a flat text file, where each line is considered a sentence. The bot chains words together to create sentences, which it passes to the IRC channel it is in.

Right now, sadface only supports one channel, but you can have multiple instances of sadface running with different configuration files. The configuration file is specified at runtime as an argument: python sadface-configgable.py config-file.ini

Included in sadface-bot.zip are sadface-configgable.py and default.ini. If you want to change default.ini, I encourage you to copy default.ini and change the variables, so you can have an untouched default.ini.

You can start sadface with a blank brain_file.txt, but its replies won’t make much sense at all until it’s heard a lot of conversation. I recommend putting several books into the file. Project Gutenberg is a good place to start. Separate sentences by newlines. Replies look best if there are no quotes or tabs in brain_file.txt. You can specify different brain files with your config.ini.

Interact

To play with sadface, /join #sadface on irc.foonetic.net, or supply your own IRC server, channel and brain_file.txt.

Download

sadface depends on:

  • Python 2.7.3, available in repositories or at Python.org
  • python-twisted, available in the Ubuntu, Debian and openSUSE repositories or from source at the Twisted downloads page. Installers are available for Windows and Mac.

Download sadface-bot.zip

Credits

sadface is heavily based off of Eric Florenzano‘s MomBot, which uses the twisted network stack to handle IRC.

sadface uses configuration methods written by hhokanson for AnonBot, an IRC channel anonymizer.

One comment

  1. [...] text files like Cory Doctorow plaintext books and turns them into one-sentence-per-line files that sadface likes to [...]

Leave a Reply

Your email address will not be published. Required fields are marked *