#!/usr/bin/env python3 import json, random, textwrap with open('terms.json', 'r') as f: terms = json.load(f) def make_pub(): actor = random.choice(terms['actor']) terms['actor'].remove(actor) action = random.choice(terms['action']) terms['action'].remove(action) prefix = '' sort = random.choice(terms['sort']) terms['sort'].remove(sort) media = random.choice(terms['media']) terms['media'].remove(media) if random.randint(0,2) == 0: prefix = random.choice(terms['prefix']) terms['prefix'].remove(prefix) prefix += '-' return actor + ' ' + action + ' ' + prefix + sort + ' ' + media def make_call(): text = 'Calling all ' for _ in range(20): text += make_pub() + ', ' text = text[:-2] text += '.' return text call = ''' Sorry for >< please >> /// Piet Zwart Institute Experimental Publishing (XPUB) /// %s /// Applications Deadline: May 15 2018 https://xpub.nl /// ''' % (textwrap.fill(make_call())) print(call)