cleaning up
This commit is contained in:
48
funcs/other/generators.py
Normal file
48
funcs/other/generators.py
Normal file
@ -0,0 +1,48 @@
|
||||
import numpy as np
|
||||
import random
|
||||
|
||||
|
||||
|
||||
def make_pairs(corpus):
|
||||
for i in range(len(corpus)-1):
|
||||
yield (corpus[i], corpus[i+1])
|
||||
|
||||
def nameGen():
|
||||
names = open('names.txt', encoding='utf8').read()
|
||||
corpus = list(names)
|
||||
|
||||
pairs = make_pairs(corpus)
|
||||
|
||||
word_dict = {}
|
||||
|
||||
for word_1, word_2 in pairs:
|
||||
if word_1 in word_dict.keys():
|
||||
word_dict[word_1].append(word_2)
|
||||
else:
|
||||
word_dict[word_1] = [word_2]
|
||||
|
||||
first_word = random.choice(corpus)
|
||||
|
||||
while first_word.islower() or first_word == " " or first_word == "-" or first_word == "\n":
|
||||
first_word = random.choice(corpus)
|
||||
|
||||
chain = [first_word]
|
||||
|
||||
done = False
|
||||
|
||||
while done == False:
|
||||
new_letter = random.choice(word_dict[chain[-1]])
|
||||
chain.append(new_letter)
|
||||
if new_letter == "\n":
|
||||
done = True
|
||||
genName = "".join(chain)
|
||||
print("Generated "+genName+"\n")
|
||||
return(genName)
|
||||
|
||||
def tavernGen():
|
||||
fp = ["The Silver","The Golden","The Staggering","The Laughing","The Prancing","The Gilded","The Running","The Howling","The Slaughtered","The Leering","The Drunken","The Leaping","The Roaring","The Frowning","The Lonely","The Wandering","The Mysterious","The Barking","The Black","The Gleaming","The Tap-Dancing","The Sad","The Sexy","The Artificial","The Groovy","The Merciful","The Confused","The Pouting","The Horny","The Okay","The Friendly","The Hungry","The Handicapped","The Fire-breathing","The One-Eyed","The Psychotic","The Mad","The Evil","The Idiotic"]
|
||||
sp = ["Eel","Dolphin","Dwarf","Pegasus","Pony","Rose","Stag","Wolf","Lamb","Demon","Goat","Spirit","Horde","Jester","Mountain","Eagle","Satyr","Dog","Spider","Star","Dad","Rat","Jeremy","Mouse","Unicorn","Pearl","Ant","Crab","Penguin","Octopus","Lawyer","Ghost","Toad","Handjob","Immigrant","SJW","Dragon","Bard","Sphinx","Soldier","Salmon","Owlbear","Kite","Frost Giant","'̶̧̗̣̰̞̜̤̦̖͗̈́̏͊͒͜+̴͎̰͓̱̻̝̬̼͕̥͍̪͕̮͙͂͝*̶̲̓̊̏'̷̥̺͈̞͒̆̏͋̀̐̇͆̓͊͠'̷͖̱̟̟͉̝̪̮͕̃͑́̍͆̓̌͒̄͛̇͘̚ͅ!̷̡̻̈́#̸̳̰̿̿̏͐̏̓̌̚̚͠¨̷̟͙̱͎̟̱̅̀͋̇͗͂͋͋̕͘´̴̡̡͎͔̦̜̟̼̠̰̤͋́̀̓́̄́̏͂̀͜.̸̛̭͍̮̜͑̋̀̋̈́̇̆̆̌_̸̡̥̜̞̝̮̑͑̓̓̇͜͜^̴̡̢͕̠̖̤̺̭̮̙͕̼̳̺̼͋̿̏̎̑͑̊̀̅͐̚͝͝","Arsonist"]
|
||||
tp = [" Tavern"," Inn","","","","","","","","",""]
|
||||
genTav = random.choice(fp)+" "+random.choice(sp)+random.choice(tp)
|
||||
print("Generated "+genTav+"\n")
|
||||
return(genTav)
|
28
funcs/other/movie.py
Normal file
28
funcs/other/movie.py
Normal file
@ -0,0 +1,28 @@
|
||||
import imdb
|
||||
import random
|
||||
|
||||
def movieFunc():
|
||||
print("Running !movie")
|
||||
print("Creating IMDb object")
|
||||
ia = imdb.IMDb()
|
||||
|
||||
print("Picking a movie")
|
||||
movs = open("movies.txt", "r")
|
||||
movlist = movs.read().split("\n")
|
||||
mov = random.choice(movlist)
|
||||
movs.close()
|
||||
|
||||
print("Searching")
|
||||
s_result = ia.search_movie(mov)
|
||||
|
||||
print("Picking the movie")
|
||||
movie = s_result[0]
|
||||
ia.update(movie)
|
||||
cast = movie['cast']
|
||||
pcast = ""
|
||||
for x in range(3):
|
||||
if cast[x]:
|
||||
pcast += cast[x]['name']+", "
|
||||
print("Successfully ran !movie")
|
||||
print("")
|
||||
return(movie['title'], movie['plot'][0].split("::")[0], movie['cover url'].replace("150","600").replace("101","404"), pcast[:-2])
|
1167
funcs/other/movies.txt
Normal file
1167
funcs/other/movies.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user