Skip to content

Instantly share code, notes, and snippets.

@antlauzon
Created April 25, 2020 19:02
Show Gist options
  • Save antlauzon/134bc5a26e0c1fd7528de0c94cd2f393 to your computer and use it in GitHub Desktop.
Save antlauzon/134bc5a26e0c1fd7528de0c94cd2f393 to your computer and use it in GitHub Desktop.
Salisbury Robitussin Witchcraft
import random
import subprocess
s = 'salisbury'
r = 'robitussin'
v = ['a', 'e', 'i', 'o', 'u', 'y']
def _pick(s, cs, vs, cov):
if len(cs) == 0:
return s
if cov:
s = _pick(s + cs[0], cs[1:], vs, not cov)
else:
s = _pick(s + vs[0], cs, vs[1:], not cov)
return s
while True:
w = []
for i in range(10000):
a = [c for c in s+r]
random.shuffle(a)
while a[0] == 'y':
random.shuffle(a)
vs = [vo for vo in a if vo in v]
cs = [co for co in a if not co in v]
w.append(_pick('', vs, cs, random.random() > .5))
wf = ''.join(w)
wff = ''
for wc in wf:
if random.random() < .1 and wc != 'y':
wff += " {}".format(wc)
else:
wff += wc
wss = []
wfs = wff.split()
i = 0
while i < len(wfs):
sl = int(random.random()*10)
wss.append(' '.join(wfs[i:i+sl]))
i += sl
for sp in wss:
p = subprocess.Popen(['say', '-a', '82', '-v', 'Allison', '-r', '5',"'{}'".format(sp)])
p.communicate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment