-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmto-cfg.py
29 lines (19 loc) · 1.12 KB
/
mto-cfg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""
Example script for PyCon Talk
This is a very simple context free grammar.
Each terminal node's vocabulary has been described as lists.
Here's the rules if you're interested:
S -> interjection headline ellipses pics
headline -> rapper ellipses predicate
ellipses -> ellipsis|empty string
"""
from random import choice
interjections = ["OH SNAP!", "MTO WORLD EXCLUSIVE:", "BLING BLING!", "YIKES!", "BREAKING NEWS!", "TOO CUTE!"]
rappers = ["LIL WAYNE", "KENDRICK LAMAR", "KIRKO BANGZ", "RAPPER PROBLEM", "DRAKE", "KANYE WEST", \
"NICKI MINAJ", "JIM JONES", "RICK ROSS", "LIL KIM", "IGGY AZALEA", "KIM KARDASHIAN"]
predicates = ["PUTS JUMPOFF ON BLAST ON TWITTER", "BUYS A NEW BUGATTI", "IN TROUBLE WITH THE IRS", "FOUND ON THE BEACH" ]
pics = ["(PICS INSIDE)","AND WE GOT PICS", "(PICS)", "YOU WON'T BELIEVE THE PICS!", "AND WE GOT A VIDEO!"]
ellipses = ["...", "!!!", "...", "", "", "" "", "", ""] # padded empty strings to reduce likelihood
def getHeadline():
return " ".join( [choice(rappers), choice(ellipses), choice(predicates)] )
print choice(interjections), getHeadline(), choice(ellipses), choice(pics)