lidel / meowkov

Markov chain IRC bot (PoC exercise in golang and Redis)
https://shitmeowkovsays.tumblr.com
Creative Commons Zero v1.0 Universal
7 stars 0 forks source link
chat-bot golang irc-bot markov-chain redis text-generation

meowkov

meowkov is happy to interact with humans

Build Status Coverage Status Go Report Card

Markov chain IRC bot and PoC exercise in golang and Redis

Table of Contents

Background

Meowkov is a simple Markov chain IRC bot. Created as a learning exercise in golang and Redis.

Markov Chains

Usage

Running Standalone Binary

To start your own instance:

  1. Clone the repo: git clone https://github.com/lidel/meowkov.git
  2. Copy meowkov.conf.template to meowkov.conf and change at least BotName, Channels and RedisServer
  3. Run make build to build meowkov binary
  4. Run ./meowkov
  5. That is all: meowkov bot will join specified room after a few seconds

Commands

Running with Docker

To start dockerized instance with latest Redis:

  1. Clone the repo: git clone https://github.com/lidel/meowkov.git
  2. Copy meowkov.conf.template to meowkov.conf and change at least BotName and Channels (RedisServer will be set automatically by Docker)
  3. Run make docker-rebuild to build (in foreground) and run (in background) via Docker container
  4. That is all: meowkov bot will join specified room after a few seconds

Docker Commands

Makefile provides commands that simplify build and deployment.
Commands assume meowkov.conf to be present in the same directory as Makefile.
Redis data with corpus is persisted to data/dump.rpd.

Populating Corpus

The bot is as good as its corpus.
Running it with empty one will not produce any meaningful results for a long time.
It is a good idea to bootstrap the corpus using old IRC logs, news articles, etc.

Text can be loaded into the corpus (which is backed by Redis) like this:

echo "line one\nline two with more text" | make docker-corpus-add

or if run in standalone mode:

echo "line one\nline two with more text" | ./meowkov -import=true -purge=false

One may also want to generate input on a different machine, for example from weechat logs:

find ~/.weechat/logs -name "*#foo*" -type f -exec sh -c "grep -vP '^.+\t(</-|-->|--|.*\*)\t' {} | cut -f3 -d$'\t'" \; > corpus.txt

Then transfer the file to the box with meowkov and perform import there:

cat corpus.txt | make docker-corpus-add

Changes are instantaneous: corpus import can be performed while bot is running, no restart is required.
The same text can be imported multiple times: Markov chains are kept in Redis Sets which provide automatic deduplication.

License

CC0 Public Domain Dedication