This repository has been moved to gitlab.com/paul-nechifor/reddit-cloud.
Old readme:
This is a Reddit bot which generates word clouds for comments in submissions. I'm running it on user WordCloudBot2. You can read a longer description on my blog. Skip down to the instructions to run it by yourself.
-
How does the bot operate?
It gets submissions from /r/all ordered by hot. It reads all the comments in a submission, eliminates the common words, generates a word cloud, posts it to Imgur and posts the link in that submission. -
Do the images update?
No. It would be impractical to revisit posts. -
The fonts are horrible and unreadable.
It's supposed to be more artistic than readable. -
This bot is bad. Does anybody like this?
Yes. Some people think it's nice. Please don't ban the bot if you're a mod. -
How are the word clouds generated? Where is that code?
That's not in the bot source. It uses my fork of Andreas Mueller's word_cloud. It basically draws all words to a black and white canvas and when a new word is added it checks if writing it there would intersect other written pixels. You can imagine that intersecting complex font paths would be way more intensive. -
Do you take requests?
I haven't written that do be done automatically, I probably should.
I am going to go on a limb and suggest that you should probably use virtualenv in order to use this script.
Install the script's dependencies:
pip install cython # Need this first.
pip install -r requirements.txt
Copy the sample configuration file:
cp config-sample.json config.json
You need to register a new Reddit account to use for your bot and change the
username
and password
fields in config.json
.
Get an Imgur account and then register for an application. Put the client
ID you get in clientId
.
Place any OTF or TTF font files in fonts/
. Fonts are randomly chosen from
there when a word cloud is generated. Open Sans is included by default.
You normally start the bot by running:
python2 bot.py hot
To post a word cloud of somebody's comments as a reply to a post do:
python2 bot.py user-hist <username> <full-permalink-of-the-comment>
To view the help run:
python2 bot.py -h
If you are using Mac OS X, you might have to install a Fortran compiler in order to fulfill some of the dependencies.
MIT