This is a bot that generates daily aphorisms from news headlines and social media commentary. It is based on an idea from the Oulipo for inventing aphorisms by using a computer to insert nouns and verbs into formulas. The bot finds words in a Word2Vec model constructed from headlines and social media statuses. In this way it offers a zeitgeist that emerges from the Internet.
- Install
Python 3.8
(as a virtual or Paas environment). - Install the Python modules in
requirements.txt
. - Create a
docs
subfolder. This is where content from headlines and social media (now only Mastodon) will be archived. - Create an
aphorisms
subfolder. This is where lists of aphorisms will be archived. - Create a
hate_speech
subfolder. This is where aphorisms classified as hateful are archived. These aphorisms are not shared publicly. - Rename
mastodon_credsTEMPLATE.py
asmastodon_creds.py
and supply your personal credentials. - Run
getDocsMastodon.py
to download content from news headlines and Mastodon. I run this script twice a day (every twelve hours). - Run
pruneDocs.py
to eventually delete news and social media content that is over 90 days old. - Run
buildModel.py
to build the Word2Vec model from the archive indocs/
. - Run
generateAphorisms.py
for a list of around 200 aphorisms. The code is parameterized to generate a total of at least 50,000 words in 30 days for NaNoGenMo 2022. - Run
sendToots.py
to share the aphorisms on Mastodon, one every 30 minutes. - Here is a sample crontab file to automate things:
# IMPORTANT NOTE!
# Please make sure there is a blank line after the last cronjob entry.
0 2,14 * * * /your/path/to/Zeitgeisty/getDocsMastodon.py
30 2 * * * /your/path/to/Zeitgeisty/pruneDocs.py
0 3 * * * /your/path/to/Zeitgeisty/buildModel.py
0 4 * * * /your/path/to/Zeitgeisty/generateAphorisms.py
30 4 * * * /your/path/to/Zeitgeisty/sendToots.py