Skip to content

Instantly share code, notes, and snippets.

@makyo
Created July 16, 2019 00:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makyo/550339c49bc49ac9c51d76dda93e02f7 to your computer and use it in GitHub Desktop.
Save makyo/550339c49bc49ac9c51d76dda93e02f7 to your computer and use it in GitHub Desktop.
import json
import html2text
import markovify
with open('outbox.json', 'rb') as f:
outbox = json.load(f)
corpus = ''
for toot in outbox['orderedItems']:
if toot['type'] == 'Create':
corpus += '\n' + html2text.html2text(toot['object']['content'])
model = markovify.Text(corpus)
for i in range(5):
print(model.make_sentence())
@makyo
Copy link
Author

makyo commented Jul 16, 2019

To use

Download your account archive and unzip it. Put markovstodon.py in the directory where you find outbox.json

virtualenv venv --python=`which python3`
source venv/bin/activate
pip install html2text markovify
python markovstodon.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment