Python Twitter bot originally intended to replicate the in{,s}anity of @johnflinchbaugh. Primary components are:
markovgen.py
: class that reads in a plain text corpus and generates random sentences based on the inputflinchbot.py
: class that connects to a Twitter account, checks for and responds to mentions, and occasionally posts a random tweetmessageparse.py
: simple script for extracting messages from a Facebook data dumpmessages.htm
file and outputting plain text
python markovgen.py -n 12 -c 3 < input.txt
: generates a random fragment of (at least) 12 words where each 3-token phrase appears somewhere in the input filepython flinchbot.py
: responds to any new mentions and posts a new tweet with some small probabilitypython messageparse.py -n 'John Fontana Flinchbaugh' < messages.htm
: processes Facebook messages and extracts plain text contents of messages from John Fontana Flinchbaugh
- Would be nice to have responses be vaguely context aware. One possible approach: identify most significant/unusual words, find a list of related words, and seed the sentence generator with one of them.
- Cache data structure somewhere so that it doesn't have to be constructed from text each time. More complicated logic like the above idea would likely require this to avoid excessive computational cost.