fabulous / fabulous / gotham.py

"""
    fabulous.gotham
    ~~~~~~~~~~~~~~~

    I implement functions to satisfy your darker side.

"""

import sys
import random
import itertools


them = ['angels', 'mourners', 'shadows', 'storm clouds', 'memories', 'condemned',
        'hand of Heaven', 'stroke of death', 'damned', 'witches', 'corpses']
them_verb = ['follow', 'hover close', 'approach', 'loom', 'taunt',
             'laugh', 'surround', 'compell', 'scour']
adj = ['cold', 'dead', 'dark', 'frozen', 'angry', 'ghastly', 'unholy', 'cunning', 'deep',
       'morose', 'maligned', 'rotting', 'sickly']
me_part = ['neck', 'heart', 'head', 'eyes', 'soul', 'blood', 'essence', 'wisdom']
feeling = ['pain', 'horror', 'frenzy', 'agony', 'numbness', 'fear', 'love',
           'terror', 'madness', 'torment', 'bitterness', 'misery']
angst = ['care', 'understand', 'question']
me_verb = ['flee', 'dance', 'flail madly', 'fall limply', 'hang my head', 'try to run',
           'cry out', 'call your name', 'beg forgiveness', 'bleed', 'tremble', 'hear']
action = ['sever', 'crush', 'mutilate', 'slay', 'wound', 'smite', 'drip',
          'melt', 'cast', 'mourn', 'avenge']
place = ['the witching hour', 'the gates of hell', 'the door', 'the path', 'death',
         'my doom', 'oblivion', 'the end of life', 'Hell', 'nothingness', 'purgatory',
         'void', 'earth', 'tomb', 'broken ground', 'barren land', 'swirling dust']


def lorem_gotham():
    """Cheesy Gothic Poetry Generator

    Uses Python generators to yield eternal angst.

    When you need to generate random verbiage to test your code or
    typographic design, let's face it... Lorem Ipsum and "the quick
    brown fox" are old and boring!

    What you need is something with *flavor*, the kind of thing a
    depressed teenager with a lot of black makeup would write.
    """
    w = lambda l: l[random.randrange(len(l))]
    er = lambda w: w[:-1]+'ier' if w.endswith('y') else (w+'r' if w.endswith('e') else w+'er')
    s = lambda w: w+'s'
    punc = lambda c, *l: " ".join(l)+c
    sentence = lambda *l: lambda: " ".join(l)
    pick = lambda *l: (l[random.randrange(len(l))])()
    while True:
        yield pick(
            sentence('the',w(adj),w(them),'and the',w(them),w(them_verb)),
            sentence('delivering me to',w(place)),
            sentence('they',w(action),'my',w(me_part),'and',w(me_verb),'with all my',w(feeling)),
            sentence('in the',w(place),'my',w(feeling),'shall',w(me_verb)),
            sentence(punc(',', er(w(adj)),'than the a petty',w(feeling))),
            sentence(er(w(adj)),'than',w(them),'in',w(place)),
            sentence(punc('!','oh my',w(me_part)),punc('!','the',w(feeling))),
            sentence('no one',s(w(angst)),'why the',w(them),w(them_verb + me_verb)))


def lorem_gotham_title():
    """Names your poem
    """
    w = lambda l: l[random.randrange(len(l))]
    sentence = lambda *l: lambda: " ".join(l)
    pick = lambda *l: (l[random.randrange(len(l))])()
    return pick(
        sentence('why i',w(me_verb)),
        sentence(w(place)),
        sentence('a',w(adj),w(adj),w(place)),
        sentence('the',w(them)))


def main(args):
    """I provide a command-line interface for this module
    """
    print
    print "-~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~-"
    print lorem_gotham_title().center(50)
    print "-~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~--~*~-"
    print
    poem = lorem_gotham()
    for n in range(16):
        if n in (4, 8, 12):
            print
        print poem.next()
    print


if __name__ == '__main__':
    main(sys.argv)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.