Exemplo n.º 1
0
Generates titles for the next AAA blockbuster.
"""
from __future__ import print_function
import dataloaf as loaf

noun = loaf.choice((
    'Age Battle Call Colossus Company Chronicles Dawn Day Defeat Duty Empires '
    'Fortune Future Gears Heroes Honor League Legends Medal Men Origins '
    'Prince Soldier Shadow Star War World'
).split())

fantasy_noun = loaf.choice((
    'Age Battle Blade Champions Chronicles Curse Dark Darkness Dragon Eternal '
    'Fable Fire God Guild Heroes Knights Legend Lost Night Quest Shadow Tales '
    'Wonders Wrath'
).split())

title = loaf.choice([
    loaf.join(' ', [noun, 'of', noun]),
    loaf.join(' ', [fantasy_noun, fantasy_noun]),
    loaf.join(' ', [fantasy_noun, 'of the', fantasy_noun]),
])

game = loaf.choice([
    title,
    loaf.join(': ', [title, title]),
])

if __name__ == '__main__':
    print(game.bake())
Exemplo n.º 2
0
noun = loaf.choice((
    'killer man vomit machine sofa zombie horse door beef anger fire water '
    'house summer lip hammock stick robot wheel'
).split())

cap_noun = loaf.transform(noun, lambda x: x.capitalize())

uncountable_noun = loaf.choice(
    'Man Vomit Beef Anger Fire Water Summer'.split()
)

adjective = loaf.choice((
    'Cold Electric Sea Giant Nuclear Flaming Old Battle Damp DJ Summer Proto'
).split())

# This is a pretty gnarly example! It could probably be refactored.
band_name = loaf.weighted([
    (1, loaf.join('', ['The ', cap_noun, 's'])),
    (1, loaf.join('', ['The ', adjective, ' ', cap_noun, 's'])),
    (1, loaf.join('', ['The ', cap_noun, ' ', cap_noun, 's'])),
    (1, loaf.join('', [adjective, ' ', cap_noun])),
    (2, loaf.join('', [cap_noun, noun])),
    (2, loaf.join('', [cap_noun, ' ', cap_noun])),
    (1, loaf.join('', [cap_noun, ' ', cap_noun, 's'])),
    (1, loaf.join('', [cap_noun, 's of ', uncountable_noun]))
])

if __name__ == '__main__':
    print(band_name.bake())
Exemplo n.º 3
0
"""
Data Loaf usage example: Goldblum generator
Generates alternate names by which you could address Jeff Goldblum, should you
ever encounter him removing his shoes at an airport. See also: Idle Thumbs 43
"""
from __future__ import print_function
import dataloaf as loaf

blum = loaf.choice(
    'jeff gold blum game cold fold gate blast cast cool coat'.split()
)

gold = loaf.transform(blum, lambda x: x.capitalize())

mc = loaf.weighted([
    (1, 'Mc'),
    (9, ''),
])

goldblum = loaf.weighted([
    (16, loaf.join('', [gold, ' ', mc, gold, blum])),
    (8, loaf.join('', [gold, blum, ' ', mc, gold, blum])),
    (1, loaf.join(' ', [gold] * 9)),
])

if __name__ == '__main__':
    print(goldblum.bake())
Exemplo n.º 4
0
    (1, '1%'),
 ])

syrup = loaf.choice([
    'vanilla', 'caramel', 'hazelnut', 'toffee nut', 'cinnamon dolce',
    'peppermint', 'raspberry', 'coconut',
 ])

quantity = loaf.choice('add no extra light'.split())

quantifiable = loaf.choice('foam whip sprinkles ice'.split())

sugar = loaf.choice(['one splenda', 'one sugar'])

modification = loaf.weighted([
    (4, loaf.join(' ', [quantity, quantifiable])),
    (1, temperature),
    (1, sugar),
    (1, 'drizzle'),
    (1, 'cinnamon powder'),
    (1, 'stirred'),
    (1, 'upside-down'),
])

# Most drinks don't have many modifications
modification_list = loaf.weighted([
    (1, loaf.join(' ', [modification] * 4)),
    (2, loaf.join(' ', [modification] * 3)),
    (10, loaf.join(' ', [modification] * 2)),
    (15, loaf.join(' ', [modification] * 1)),
    (10, None),
Exemplo n.º 5
0
"""
Data Loaf usage example: Ghiscari names
Builds names that sound like Ghiscari characters from George R. R. Martin's
"A Song of Ice and Fire" novels.
"""
from __future__ import print_function
import dataloaf as loaf

start = loaf.choice('Gr Kr Pr Ozn Gh H N'.split())
vowel = loaf.choice('e a ah i y o'.split())
middle_consonant = loaf.choice('d l s z n zn nd'.split())
end_consonant = loaf.choice('d k l s r z n'.split())

middle = loaf.weighted([
    (1, ''),
    (2, loaf.join('', [vowel, middle_consonant])),
])
end = loaf.join('', [vowel, end_consonant])

name = loaf.join('', [start, middle, end])

zo = loaf.weighted([
    (3, 'zo'),
    (3, 'mo'),
    (1, 'na'),
])

full_name = loaf.join(' ', [name, zo, name])

if __name__ == '__main__':
    print(full_name.bake())
Exemplo n.º 6
0
"""
Data Loaf usage example: silly names
Generates ridiculous names that sound vaguely like "Bleff Jorgenson".
"""
from __future__ import print_function
import dataloaf as loaf

first_name = loaf.join('', [
    loaf.choice('Ch Bl Fl J'.split()),
    loaf.choice('e o a'.split()),
    loaf.choice('ff b g d rg sk rge n'.split()),
])

last_name = loaf.join('', [
    loaf.choice('Ja Jo Bla Gla De Sti'.split()),
    loaf.choice('ngle r bble ps ddings'.split()),
    loaf.choice('blab frob fran blerg stein rton'.split()),
])

name = loaf.join(' ', [first_name, last_name])

if __name__ == '__main__':
    print(name.bake())
Exemplo n.º 7
0
from __future__ import print_function
import dataloaf as loaf

someone = loaf.weighted([
    (2, 'I'),
    (2, 'you'),
    (1, "y'all"),
    (1, 'we'),
 ])
cap_someone = loaf.transform(someone, lambda x: x.capitalize())
someones = loaf.choice('my your'.split())
and_but_so = loaf.choice('and but so'.split())
to_a_place = loaf.weighted([
    (1, 'on out to the pasture'),
    (2, 'on out to the field'),
    (3, loaf.join(' ', ['on out to', someones, 'ranch'])),
    (1, 'on out to the rodeo'),
    (1, 'to the general store'),
    (2, 'to the bar'),
    (1, 'to the honkytonk'),
    (1, 'to the hoedown'),
    (2, 'to the barn'),
    (1, "fishin'"),
])
adjective = loaf.weighted([
    (2, 'drunken'),
    (2, 'no-good'),
    (2, 'low-down'),
    (2, 'dirty'),
    (1, 'darned'),
    (1, "gol'darned"),