diff --git a/bot.py b/bot.py index 312655d..882a48f 100644 --- a/bot.py +++ b/bot.py @@ -1,4 +1,4 @@ -import teambot, sys, traceback, requests, random, notes, words +import teambot, sys, traceback, requests, random, notes, words, markovuniverse from titlecase import titlecase BOTOP = "~minerobber@127.0.0.1" @@ -79,6 +79,11 @@ class MinerbotPhoenix(teambot.Handler): self.say(channel,nick+": "+titlecase(" ".join(result))) def on_kwam(self,channel,nick,*a): self.on_backronym(channel,nick,"kwam") + def on_su(self,channel,nick,subcmd="help",*args): + if subcmd=="help": + self.say(channel,nick+": Current subcommands: !su fake-leak") + elif subcmd=="fake-leak": + self.say(channel,nick+": {} - {}".format(*markovuniverse.new_episode())) if __name__=="__main__": words.loadDict("american-english-small") diff --git a/data/get_synopses.py b/data/get_synopses.py new file mode 100644 index 0000000..e5da590 --- /dev/null +++ b/data/get_synopses.py @@ -0,0 +1,13 @@ +import markov,tvdb_api + +t = tvdb_api.Tvdb(language="en") +first = True +synopses = markov.Chain() +for season in t['Steven Universe']: + if first: + first = False + continue + for episode in t['Steven Universe'][season]: + synopses.train(t['Steven Universe'][season][episode]['overview']) +with open("synopses.json","w") as f: + f.write(synopses.to_json()) diff --git a/data/get_titles.py b/data/get_titles.py new file mode 100644 index 0000000..3ad6cfd --- /dev/null +++ b/data/get_titles.py @@ -0,0 +1,13 @@ +import markov,tvdb_api + +t = tvdb_api.Tvdb(language="en") +first = True +titles = markov.Chain() +for season in t['Steven Universe']: + if first: + first = False + continue + for episode in t['Steven Universe'][season]: + titles.train(t['Steven Universe'][season][episode]['episodename']) +with open("titles.json","w") as f: + f.write(titles.to_json()) diff --git a/data/markov.py b/data/markov.py new file mode 100644 index 0000000..a43090c --- /dev/null +++ b/data/markov.py @@ -0,0 +1,42 @@ +import random,json +class Chain: + def __init__(self): + self.map = {} + + def addWord(self,lastWord,word): + if lastWord in self.map and not word in self.map[lastWord]: + self.map[lastWord].append(word) + elif not lastWord in self.map: + self.map[lastWord] = [word] + + def train(self,sentance): + words = sentance.split(" ") + lastWord = words.pop(0) + self.addWord("",lastWord) + for word in words: + self.addWord(lastWord,word) + lastWord = word + self.addWord(lastWord,"") + + def generate(self): + lastWord = random.choice(self.map[""]) + sentence = lastWord + while lastWord != "": + word = random.choice(self.map[lastWord]) + sentence += " " + word + lastWord = word + return sentence[:-1] + + def to_json(self): + return json.dumps(self.map) + + @classmethod + def from_json(cls,jsonstr): + ret = cls() + ret.map = json.loads(jsonstr) + return ret + +def addLinesFromFile(chain,filename): + with open(filename) as f: + for line in f.readlines(): + chain.train(line.rstrip()) diff --git a/data/synopses.json b/data/synopses.json new file mode 100644 index 0000000..dfd2e8c --- /dev/null +++ b/data/synopses.json @@ -0,0 +1 @@ +{"": ["Steven", "", "When", "Steven\u2019s", "While", "During", "A", "Pearl", "After", "Steven's", "The", "To", "Lion", "Buck,", "Greg", "Steven,", "Ronaldo", "Garnet", "Amethyst", "Tension", "Lapis", "Kiki", "Connie", "Following", "An", "People", "With", "Kevin", "Stevonnie", "In", "Lars", "Ruby", "TBA"], "watermelons": ["shaped"], "Off-Color": ["Gems"], "Jasper,": ["whilst", "Peridot"], "frustration": ["with"], "makes": ["a"], "unusual": ["new"], "Spire.": [""], "her": ["day.", "home", "about", "to", "broken", "live", "first", "fight", "and", "metal", "\"prisoners\".", "cheer", "frustrating", "from", "mother", "future", "decision.", "cell"], "stranger": ["into"], "With": ["Steven's", "Peridot", "many"], "Cats,": ["which"], "Thus,": ["Steven"], "moon": ["and,", "houses", "base"], "taking": ["them"], "it": ["is", "snows.", "doesn't", "off", "becomes", "unlocks."], "An": ["item"], "skewed": ["by"], "unintentional": ["side"], "strange": ["dream"], "Cat,": ["has"], "sleeping.": [""], "party.": ["However,"], "Following": ["the"], "ago.": [""], "other": ["ideas.", "side,"], "streams,": ["so"], "feud.": [""], "moon,": ["Steven"], "becomes": ["depressed", "determined", "curious", "stuck", "apparent"], "Centipeetle.": ["However,"], "Greg,": ["and", "Garnet's"], "night": ["spent"], "Grandpa": [""], "through": ["his", "the", "her", "Lion's"], "life,": ["but", "Steven"], "Ronaldo,": ["Lars,"], "impress": ["Connie's"], "build": ["a"], "occurrences": ["in"], "bubbled": ["Gem,"], "Justice": ["for"], "communicate": ["with"], "heavily": ["rushed"], "short": ["to"], "unpredictably,": ["attempting"], "script.": [""], "them.\r\n": [""], "escape": ["pod."], "mysteriously": ["communicate"], "discovers": ["the", "what", "that", "Onion's"], "party": ["out", "with", "to"], "difficult": ["campaign."], "gem": ["shard", "bubble", "monster", "fusion"], "monster": ["from", "through", "in"], "Gem,": ["Steven,"], "fortunes": ["at"], "mission": ["to", "with"], "audience": ["doesn't"], "searching": ["for"], "motel": ["with"], "around": ["him.", "his", "Beach"], "Base,": ["with"], "where": ["Garnet", "to"], "are": ["thousands", "being", "stuck", "disappearing", "now", "changing,"], "Temple": ["to", "that"], "astral": ["projection"], "familiar": ["face"], "rekindles": ["a"], "flowers": ["at"], "once": ["belonged"], "rise": ["of"], "moon.": [""], "Light": ["Cannon,"], "partner": ["for"], "they\u2019ve": ["missed,"], "pull": ["it", "off"], "shard": ["that"], "story": ["of", "when"], "having": ["nightmares", "trouble"], "decide": ["to"], "activating": ["his"], "slumber": ["party."], "Earth,": ["Steven", "but"], "phone.": ["While"], "speedy": ["corrupted"], "life.": [""], "TV": ["show"], "Beach": ["City,", "City", "City.", "City!"], "shape": ["shifting,", "shift"], "self-esteem": ["has"], "Kofi,": ["it"], "propaganda,": ["so"], "elusive": ["speedy"], "Rose": ["Quartz.", "babysat", "Quartz"], "goes": ["to", "on", "into", "up"], "like": ["himself."], "all": ["the", "his"], "than": ["Steven"], "barn.": [""], "want": ["a", "her", "to"], "each": ["other,"], "Cannon,": ["which"], "traversing": ["the"], "pursuers.": [""], "bottom.": ["With"], "heads.": [""], "damages": ["Fish"], "teach": ["Steven"], "fusion": ["powers.", "from", "so"], "heist.": [""], "on": ["Sadie,", "the", "vacation", "Steven's", "a", "her", "trial.", "Homeworld,", "Earth", "an", "Steven", "Earth.", "in"], "Suspects.": ["The"], "lift": ["his"], "cause": ["a"], "band,": ["but", "Sadie"], "reconnect,": ["Lapis"], "meet": ["Lars"], "trial.": [""], "hoping": ["to"], "get": ["a", "the", "to", "them", "super", "along", "back", "revenge", "awry", "invited", "his"], "Kindergarten.": ["To", ""], "pearl": ["to"], "trouble.": [""], "They": ["decide", "discover"], "rushed": ["and"], "owners'": ["kids,"], "proportions.": [""], "he": ["likes.", "sees", "doesn't", "first", "learned", "tries", "has", "becomes", "uses", "and", "can"], "book.": [""], "asked": ["by"], "To": ["impress", "cheer", "fight", "try", "stay"], "account": ["for"], "rising": ["power,"], "lurk": ["around"], "request": ["but"], "Kindergarten": ["and", "in"], "\r\n": [""], "t-shirts": ["together."], "have": ["to", "some", "a", "trouble", "stolen", "been"], "travel": ["device", "through"], "begins": ["feeling", "to"], "Killer": ["and"], "monster,": ["Steven"], "shaped": ["like"], "solve": ["the"], "protect": ["a", "it,"], "spends": ["a"], "holds.": [""], "themself.": ["They"], "misadventures": ["in"], "boat": ["ride"], "and,": ["unable"], "happened": ["to"], "mayor": ["Bill"], "suspects": ["she"], "been": ["taken", "having", "skewed"], "teaches": ["Connie"], "airlock,": ["Steven"], "Fish": ["Stew"], "heal": ["Amethyst's", "the"], "ground.": [""], "feels": ["when"], "eye": ["threatens"], "better.": [""], "Gems'": ["past", "perspective."], "depressed": ["when"], "Lion's": ["mane.", "mane"], "who": ["writes", "hooks"], "Big": ["Donut.", "Donut;"], "mother,": ["Rose", "Vidalia,"], "help.": [""], "warp": ["streams,"], "rises": ["between"], "library": ["with"], "Vidalia.": [""], "search": ["for", "and"], "Amethyst.": [""], "throwing": ["a"], "floating": ["in"], "mirror": ["that"], "made": ["Kindergarten"], "kittens,": ["Garnet"], "family": ["and", "barn", "continues", "together."], "worthy": ["to"], "interrupted": ["by"], "Bubble": ["to"], "participating": ["in"], "decides": ["to", "he"], "by": ["using", "working", "taking", "Ronaldo's", "recurring", "a", "Jamie", "Mayor", "catching", "planting", "Homeworld"], "at": ["the", "Fish", "Funland.", "first,"], "go.": [""], "hit": ["rock"], "herself.": [""], "fuse": ["together", "again,", "into"], "remaining": ["Cookie"], "feud": ["between"], "make": ["up", "t-shirts", "a"], "catching": ["Peridot"], "ending": ["to"], "revisit": ["Kindergarten"], "again,": ["Greg", "they"], "now": ["the", "on"], "up,": ["but"], "owners": ["Fryman"], "supplies": ["for"], "first": ["day", "met", "mission", "winter"], "believing": ["in"], "finding": ["their"], "battle": ["damages"], "funded": ["by"], "doubts": ["believing"], "campaign.": [""], "afraid": ["of"], "history": ["of"], "party,": ["and"], "arrives": ["in"], "Arcade": ["where"], "favorite": ["brand", "sitcom,", "TV"], "friends.": [""], "baseball.": [""], "more": ["historically", "complicated"], "they": ["fuse", "are", "have", "see", "can", "reach", "discover"], "truth": ["about"], "taken": ["off", "in"], "beliefs": ["about"], "injuring": ["his"], "this": ["documentary-style"], "sees": ["something", "the"], "grow.": [""], "him.": [""], "tries": ["to"], "wonders": ["what"], "the": ["market.", "Crystal", "last", "key", "only", "help", "cannon.", "Lunar", "power", "allure", "Sky", "Gems", "thousands", "cool", "art", "Temple", "relationship", "powerful", "Big", "perfect", "story", "first", "cosmos,", "pieces.", "warp", "future", "possible", "road.", "lighthouse", "Wailing", "situation.", "mailman", "Temple.", "ocean", "Gems,", "temple", "family", "barn,", "moon.", "Cluster.", "barn.", "sky", "ground.", "roller", "rave.", "restaurant", "feud.", "Centipeetle.", "time", "Great", "events", "previous", "weakest", "team,", "Gems'", "middle", "Beta", "barn", "Rubies", "Moon", "process.", "library", "rock", "abandoned", "point", "audience", "Cool", "mystery.", "Kindergarten.", "band.", "other", "Off-Color", "run", "moon", "Diamonds.", "history", "rise", "Suspects.", "way.", "unexpected.", "current", "town", "now-former", "new", "moon,", "two", "shattering", "shocking", "secret", "world."], "discovered": ["inside"], "Steven,": ["Amethyst,", "Amethyst", "exhausted", "Peridot", "Greg", "Garnet", "Pearl", "Lars"], "accurate": ["script."], "float.": ["However,"], "beat": ["him"], "coughs": ["up"], "world.": [""], "tradition": ["lands"], "quits": ["wrestling"], "gemstone": ["when"], "what": ["Garnet", "happened", "makes", "it", "the"], "before": ["it"], "metal": ["powers."], "act": ["for"], "bit": ["more"], "must": ["fend"], "Vidalia,": ["while"], "stuck": ["in", "floating"], "needs": ["a"], "may": ["hold"], "try": ["to", "out", "and"], "Buck": ["Dewey"], "City!": [""], "Special": ["Mission"], "spent": ["searching"], "Empire": ["City", "City,"], "eventually": ["discover"], "Onion": ["escalates", "shows"], "cookout": ["at"], "rattled": ["by"], "Lil'": ["Butler."], "Gem.": [""], "life": ["out"], "After": ["a", "seeing", "injuring", "hearing", "accidentally", "witnessing", "recent", "being", "Ronaldo"], "people": ["living"], "Sour": ["Cream"], "parents,": ["Steven"], "escape!": [""], "quest": ["to"], "master": ["the"], "swore": ["Pearl"], "travels": ["deep", "to"], "babysat": ["Sour"], "Jamie": ["the", "to"], "birthday": ["party"], "Pearl's": ["actions", "pearl"], "reunion.": [""], "share": ["his"], "love": [""], "Stone.": [""], "capture": ["Peridot,"], "lighthouse": ["to"], "weakest": ["Gem"], "temple": ["for", "to"], "Fryman": ["with", "and"], "room": ["in"], "future": ["and", "vision", "holds."], "Connie's": ["parents,", "mother.", "father"], "monster.": [""], "throws": ["a"], "barn,": ["and"], "side": ["effects."], "him": ["in", "build", "relax.", "about"], "pretend": ["to"], "secret.": [""], "there.": ["When"], "A": ["toy", "garage", "new", "friend", "familiar", "strange"], "that": ["could", "can", "the", "answers", "his", "Garnet", "lurk", "belonged", "he", "they", "she", "same", "Connie", "Lars"], "go": ["quite", "into", "on", "away,", "to", "at"], "stolen": ["a"], "back": ["to", "on", "so"], "team": ["to", "of"], "Malachite": ["in"], "red": ["eye"], "device": ["to"], "flee": ["Earth"], "off-color": ["crew."], "re-ignites": ["an"], "has": ["been", "other", "to", "Pearl", "a", "some", "doubts", "the", "hit"], "doubt": ["the"], "Lapis": ["wakes", "go", "have", "and", "wants", "leaving", "Lazuli", "is"], "spirits.": [""], "pieces.": [""], "face": ["while", "comes"], "item": ["from"], "shenanigans": ["get"], "restaurant": ["owners", "owners'"], "could": ["possibly"], "Sky": ["Spire,"], "stake": ["out."], "searches": ["through"], "leg,": ["Greg"], "admits": ["how"], "determined": ["to"], "ability": ["while"], "wrestling": ["league.", "at", "when"], "lost": ["book.", "and"], "Cookie": ["Cat,", "Cats,"], "caught": ["up"], "curious": ["about"], "Magic": ["Crystal"], "nightmares": ["due"], "\u2013": ["a"], "frustrating": ["job"], "when": ["his", "the", "Steven", "she", "he", "Peridot", "Kevin"], "much": ["Pearl"], "hearing": ["how"], "friends": ["get"], "relax.": [""], "Wailing": ["Stone."], "unlocks": ["a"], "day.": [""], "so": ["the", "Steven", "he", "she", "special.", "himself", "they", "Garnet"], "father,": ["Greg,"], "allies.": ["\r\n"], "sword": ["fight", "from"], "return": ["to"], "Diamond": ["at"], "suspect": ["that"], "letter": ["from"], "himself.": [""], "Pizza": ["family"], "Tension": ["rises"], "shift": ["his", "at"], "living": ["in"], "invites": ["Steven"], "pod.": [""], "garage": ["sale"], "storage": ["in"], "meets": ["Uncle"], "study": ["what"], "sentient": ["watermelons."], "due": ["to"], "mother.": [""], "past": ["is"], "message": ["from"], "watermelons.": [""], "City": ["is", "Weird\"", "with", "while", "and"], "manage": ["to"], "theatre,": ["but"], "popping": ["a"], "mend": ["the", "Lars"], "came": ["to"], "keep": ["many"], "yet.": [""], "snows.": [""], "job": ["by", "at", "keeps"], "Sunshine": ["Justice"], "gets": ["his", "interrupted"], "away,": ["Amethyst"], "puts": ["himself"], "play": ["funded"], "Homeworld": ["propaganda,"], "Garnet's": ["frustration"], "movie": ["theatre,"], "hooks": ["them"], "City.": ["", "While"], "missed,": ["and"], "show,": ["and"], "late-night": ["joyride"], "town": ["and"], "process.": [""], "out": ["of", "with", "by", "that", "life", "on", "at", "to"], "girl": ["he"], "crew.": ["The"], "teams": ["up"], "town,": ["but"], "contact": ["Yellow", "Lars,"], "base": ["and", "to"], "creepy": ["traversing"], "Beach-a-Palooza.": [""], "Pizza,": ["Steven", "so"], "Gems,": ["in"], "barn": ["to", "still", "brings", "on"], "revenge": ["for"], "uses": ["a", "his", "them"], "In": ["this"], "disappears": ["on"], "strong.": [""], "Steven": ["becomes", "believes", "enlists", "packs", "helps", "attempts", "creates", "tries", "joins", "befriends", "takes", "learns", "begins", "and", "the", "throws", "needs", "accidentally", "Tells", "gets", "is", "asks", "wonders", "discovers", "thinks", "how", "finds", "goes", "has", "teams", "out", "meets", "around", "suspects", "sneaks", "travels", "visits", "thought.", "agree", "to", "puts", "tells", "about", "continues", "soon", "struggles", "on", "only", "doesn't", "get", "brings", "records", "eventually", "updating", "prompts", "confronts", "uses", "faces"], "band.": [""], "relationship": ["between"], "watch": ["scary"], "Temple.": [""], "key,": ["and"], "Beta": ["Kindergarten."], "inside": ["of"], "shapeshifts": ["into"], "cheer": ["Amethyst", "up"], "visits": ["Empire", "the", "a"], "When": ["a", "Lars", "Steven", "Steven's", "Amethyst", "Lapis", "they", "she"], "Ronaldo's": ["conspiracy"], "himself,": ["along"], "rave.": [""], "attempt": ["to"], "awry": ["when"], "enlists": ["the"], "complicated": ["than"], "biggest": ["challenge"], "goings-on": ["in"], "as": ["planned.", "her", "Tiger", "Stevonnie.", "their"], "mailman": ["with"], "cool": ["kids"], "paranormal": ["occurrences"], "fend": ["for"], "two": ["friends", "reconnect,"], "retrieve": ["a", "her"], "devoted": ["to"], "one": ["of"], "joyride": ["to"], "ends": ["up"], "changing,": ["the"], "Sadie.": [""], "Earth": ["to"], "records": ["the"], "games.": [""], "order": ["to"], "apparent": ["that"], "Stevonnie.": ["Steven"], "whilst": ["Steven,"], "first,": ["but"], "cell": ["phone."], "art": ["of"], "hold": ["of", "the"], "Amethyst's": ["gemstone", "self-esteem"], "Mission": ["to"], "train": ["her"], "every": ["wish."], "them": ["into", "on", "to", "the", "up"], "stepping": ["in"], "dangers": ["that"], "which": ["Steven", "once"], "is": ["a", "in", "taken", "sleeping.", "rattled", "asked", "devoted", "afraid", "too", "up", "now", "discovered", "busy.", "throwing", "having", "unsure"], "followed.": [""], "long": ["lost"], "epic": ["proportions."], "look": ["for", "after"], "Donut;": ["but"], "Yellow": ["Diamond"], "father": ["on"], "from": ["a", "space.", "the", "his", "Connie's", "Beach", "actually", "Emerald", "their", "Steven"], "spiral": ["out"], "Diamond,": ["but"], "only": ["thing", "shape", "so"], "while": ["Steven", "Onion", "dreaming"], "recovery": ["mission."], "sky": ["and"], "woman.": [""], "panic.": [""], "perfect": ["bandmate,"], "form": ["a"], "producer": ["Sunshine"], "upcoming": ["show,"], "web": ["documentary"], "stressed": ["she"], "brings": ["a", "Garnet", "everyone"], "He": ["soon"], "convince": ["Amethyst"], "recruit": ["the", "Sadie,"], "ride": ["Lion", "the", "to"], "Great": ["North"], "During": ["a"], "insults": ["Amethyst."], "other,": ["Kevin"], "tame": ["its"], "tells": ["Steven", "people's", "them", "a"], "book": ["series,"], "healing": ["powers"], "someone.": [""], "listen": ["to"], "musical": ["partner"], "wish.": [""], "releases": ["a"], "warehouse,": ["Steven"], "safe,": ["Steven"], "split": ["up"], "side,": ["they"], "special.": [""], "colony,": ["and"], "attempts": ["to"], "out-of-state": ["motel"], "spy": ["on"], "trade": ["between"], "being": ["overworked", "followed.", "sucked"], "lands": ["him"], "crash-lands": ["in"], "sitcom,": ["Lil'"], "recover": ["the", "Rose's"], "fix": ["his"], "paranoia.": [""], "Onion's": ["mother,", "secret"], "still": ["searching"], "power": ["of", "to", "outage"], "powerful": ["Sugilite,"], "allure": ["of"], "causes": ["her"], "Crystal": ["Gems", "Gems\u2019", "Bubble", "Gems.", "Gem.", "Gems'"], "keeps": ["laying", "her"], "houses": ["an"], "powers": ["suddenly", "to"], "unexpected.": ["When"], "chase": ["a"], "accidentally": ["releases", "popping", "uses", "re-ignites", "bring"], "possible": ["dangers"], "large": ["machine."], "mane.": [""], "grow": ["a", "closer"], "machine.": [""], "violent": ["instincts."], "Quartz.": ["Thus,", ""], "Quartz": ["and", "have"], "powers.": [""], "provide": ["a"], "clothing": ["to"], "cosmos,": ["Steven"], "using": ["a", "his", "the"], "teenage": ["shenanigans"], "years": ["old", "ago."], "super": ["strong."], "overworked": ["at"], "alone": ["time"], "kids,": ["to"], "doesn't": ["have", "go", "know", "take", "want"], "one.": [""], "Steven's": ["mother,", "desire", "powers.", "face", "request", "favorite", "is", "healing", "rising", "tears"], "daring": ["escape!"], "Rose's": ["Room", "sword", "rebellion"], "sets": ["out"], "convinces": ["Steven"], "point": ["of"], "Kiki": ["has"], "unlocks.": [""], "Lunar": ["Sea"], "new": ["room", "one.", "threat", "ally", "ending", "stranger", "persona.", "allies.", "band,", "status"], "prompts": ["Steven", "her"], "winter": ["together."], "beach.": [""], "Butler.": [""], "bring": ["clothing", "Lars", "his"], "another": ["droid", "Gem", "vision"], "version": ["of"], "Uncle": ["Grandpa"], "duel.": [""], "ideas.": [""], "Steven\u2019s": ["attempt", "autumn", "Gem"], "Off-Colors'": ["beliefs"], "blog.": [""], "Laser": ["Light"], "challenge": ["yet."], "cracks": ["it.\r\n"], "spend": ["some"], "birthdays.": [""], "re-enact": ["it."], "unsure": ["about"], "events": ["of"], "Connie": ["try", "the", "back", "so", "want", "help", "how", "fuse", "sneak", "run", "goes", "have", "and", "learn", "helps", "join", "will", "travel"], "quo.": [""], "stop": ["the"], "TBA": [""], "former": ["Gem"], "disturbance.": [""], "telling": ["Lapis."], "return,": ["he"], "instincts.": [""], "doing": ["so"], "harrowing": ["adventure."], "to": ["get", "activating", "destroy", "Steven's", "find", "the", "share", "life.", "master", "protect", "prove", "Garnet.", "Funland", "convince", "fuse", "make", "hang", "teach", "ride", "a", "mend", "recruit", "tame", "heal", "live", "see", "help", "recover", "pretend", "be", "grow", "ease", "use", "watch", "take", "her", "Rose", "retrieve", "rescue", "avoid", "tell", "re-enact", "lift", "sword", "pull", "her.", "split", "participate", "provide", "redeeming", "build", "do.", "his", "stop", "go.", "float.", "Beach", "beat", "himself,", "try", "being", "go", "attempt", "look", "suspect", "duel.", "Jasper's", "contact", "catch", "focus", "search", "doubt", "grow.", "solve", "fix", "life,", "Steven", "flee", "stay", "visit", "meet", "behave", "train", "account", "spy", "Earth,", "venture", "keep", "bring"], "last": ["remaining"], "broken": ["friendship", "escape"], "Cheeseburger": ["Backpack"], "a": ["hold", "menacing", "Laser", "mission", "magical", "Magic", "girl", "giant", "holographic", "movie", "battle", "cookout", "new", "shift", "musical", "time", "monster", "gem", "panic.", "spaceship.", "bubbled", "secret", "patch", "test", "Special", "place", "message", "power", "beloved", "late-night", "corrupted", "web", "dark", "night", "slumber", "friendship", "play", "more", "hospital", "large", "Crystal", "birthday", "trip", "listen", "friend's", "series", "car", "bit", "boat", "day", "heavily", "desert.", "bubble", "fusion", "long", "rock", "search", "heist.", "special", "daring", "quest", "stake", "party", "difficult", "hard", "band,", "party,", "spaceship", "jungle", "former", "strange", "performance", "letter", "story.", "big"], "diary.": [""], "confronts": ["Pearl"], "thousands": ["of"], "league.": [""], "Peridot": ["through", "and", "unintentionally", "is", "takes", "encounter", "attempts", "attempt", "learn", "wants", "upset"], "Stew": ["Pizza,"], "day": ["of", "trying", "off"], "Ruby": ["and", "goes"], "focus": ["better."], "People": ["are"], "stay": ["safe,", "on"], "conspiracy": ["theories"], "group": ["of"], "befriends": ["a"], "power,": ["Amethyst"], "fun.": ["However,"], "hires": ["Greg"], "Emerald": ["and"], "receives": ["a"], "City,": ["the", "so", "though"], "become": ["a"], "coasters.": [""], "Kids.": [""], "space.": ["", "To"], "Lars,": ["and", "must"], "Lazuli": ["using"], "band": ["hires"], "Peedee": ["Fryman"], "grueling": ["job"], "recent": ["events,"], "trying": ["to"], "asks": ["the"], "believes": ["may"], "Buck,": ["Jenny"], "market.": ["He"], "Amethyst": ["in", "and", "fuse", "try", "with", "accompany", "rekindles", "when", "take", "begins", "up", "shapeshifts", "go", "quits", "decide", "convinces"], "special": ["breakfast", "zoo.", "reunion."], "The": ["ocean", "Gems", "Crystal", "dispatch", "Off-Colors'", "band"], "there": ["and"], "it.": [""], "Gems.": [""], "\"prisoners\".": [""], "vacation": ["to"], "Jenny": ["and"], "Garnet.": [""], "herself": ["by"], "show": ["gets", "up"], "magical": ["gem", "lion.", "trouble.", "mirror", "beach.", "disturbance.", "key,"], "Lars.": ["When"], "unintentionally": ["interferes", "insults"], "there,": ["Steven"], "Kids": ["start"], "ancient": ["maze,"], "ice-cream": ["sandwich,"], "too": ["old", "short"], "can": ["bring", "only", "mysteriously", "see", "show", "fuse."], "abandoned": ["warehouse,", "Gem"], "belonged": ["to"], "gem.": [""], "Kevin": ["again,", "is", "reveals", "decides"], "North": ["to"], "planting": ["flowers"], "game": ["of"], "over": ["Lapis"], "agree": ["to"], "shifting,": ["but"], "for": ["a", "all", "birthdays.", "some", "an", "his", "Malachite", "Beach-a-Palooza.", "Vidalia.", "Jasper,", "Jasper.", "answers.", "themself.", "the", "himself."], "navigating": ["out"], "poorly": ["made"], "getting": ["caught", "in"], "again.": [""], "car": ["race"], "Jasper's": ["birthplace"], "dreams": ["of"], "fuse.": [""], "involving": ["the"], "now-former": ["mayor"], "road.": [""], "series,": ["so"], "performance": ["in"], "leaving": ["Earth,"], "learned": ["of"], "knows": ["something"], "cannon.": [""], "HIMSELF!": [""], "witnessing": ["Steven"], "bubble": ["and"], "updating": ["him"], "Tiger": ["Philanthropist."], "deep": ["underground"], "story.": [""], "visit": ["to", "Lars.", "family."], "though": ["Sadie"], "rebellion": ["from"], "packs": ["his"], "uncovers": ["a"], "time": ["unlocks", "travel", "with", "he", "together.", "telling"], "friend's": ["audio"], "venture": ["inside"], "comes": ["to", "back"], "trouble": ["when", "finding", "trying"], "video": ["games."], "Cool": ["Kids.", "Kids"], "will": ["be"], "how": ["much", "to", "he", "she", "lost"], "attempting": ["to"], "\"ex\"": ["back"], "ocean": ["disappears", "with"], "Diamonds.": [""], "autumn": ["visit"], "Sadie's": ["broken", "new"], "catch": ["an"], "and": ["searches", "Pearl", "become", "decides", "things", "Lars", "Onion", "Connie", "the", "Amethyst", "uses", "attempts", "Beach", "unintentionally", "Sadie's", "demands", "becomes", "Sadie.", "Sour", "Buck", "Garnet", "Crystal", "find", "Greg,", "Sapphire", "lets", "he", "has", "Pearl.", "ends", "Kofi,", "stop", "Lapis", "Rose", "Steven", "poorly", "Peridot", "a", "get", "runs", "uncovers", "recovery", "Sadie", "invites", "are", "orbits", "have", "his", "stressed", "its", "finds"], "but": ["can", "their", "Lion", "it", "Steven", "doesn't", "run", "with", "they", "that", "changes", "another", "instead"], "situation.": [""], "answers.": [""], "mane": ["to"], "kids": ["in"], "psychic": ["powers"], "possibly": ["destroy"], "himself": ["worthy", "in", "as"], "Kiki's": ["nightmares."], "Peridot,": ["but"], "cat": ["heads."], "hospital": ["to"], "helps": ["Peedee", "out", "Mayor", "Sadie", "two", "by", "look"], "events,": ["Pearl"], "Philanthropist.": ["However,"], "creates": ["a"], "persona.": [""], "Dewey": ["control", "make", "about", "run", "is"], "writes": ["a"], "Room": ["to"], "fingers": ["into"], "desire": ["for"], "song": ["about"], "join": ["Connie's"], "its": ["wild,", "population"], "control": ["when", "the"], "dreaming": ["and"], "Funland": ["Arcade", "but"], "breakfast": ["tradition"], "Greg": ["comes", "and", "tells", "explains", "as"], "Smoky": ["Quartz"], "takes": ["the", "them", "her"], "mother": ["getting"], "old-fashioned": ["game"], "Rubies": ["return", "want", "are", "in"], "nightmares.": [""], "know": ["where", "what"], "Lapis.": [""], "Lars": ["get", "pawns", "and", "spend", "back", "receives"], "threat": ["arrives"], "destroy": ["Beach", "it"], "sale": ["reunites"], "invited": ["to"], "documentary-style": ["episode,"], "sword-fighting": ["using"], "changes": ["his", "going"], "room.": [""], "after": ["her", "Beach"], "cheers": ["up"], "summer": ["and"], "ally": ["to"], "dark": ["secret.", "song"], "fun": ["around"], "exhausted": ["from"], "team,": ["so"], "Tells": ["Connie"], "threatens": ["to"], "Garnet": ["learns", "and", "does", "can", "chase", "has", "finally", "to", "tells", "spends", "admits"], "does": ["with"], "seeing": ["Garnet"], "actions": ["causes", "at"], "place": ["that", "in"], "population": ["are"], "ease": ["his"], "homeless": ["kittens,"], "quite": ["as"], "zoo.": [""], "underground": ["wrestling", "to"], "demands": ["a"], "avoid": ["Connie", "getting"], "giant": ["woman."], "likes.": [""], "Funland.": [""], "rock": ["bottom.", "show.", "people"], "current": ["goings-on"], "Gems": ["manage", "to", "are", "try", "encounter", "cause", "for", "revisit", "capture", "return", "take", "engage", "study", "make", "have", "on"], "Lion": ["to", "has", "keeps", "coughs"], "historically": ["accurate"], "audio": ["diary."], "prove": ["himself"], "behave": ["unpredictably,"], "movies": ["with"], "people's": ["fortunes"], "sneaks": ["a"], "up": ["when", "for", "with", "into", "to", "in", "after", "a", "by", "as", "there"], "mistakes.": [""], "Stevonnie": ["to", "crash-lands"], "she": ["cracks", "knows", "came", "is", "and", "feels", "doesn't", "swore"], "body.": [""], "friend": ["of"], "his": ["favorite", "gem.", "father,", "storage", "Cheeseburger", "special", "grueling", "fingers", "every", "work", "mission", "leg,", "dad", "mother.", "paranoia.", "fusion", "most", "spirits.", "\"Keep", "time", "room.", "ancestor,", "bathroom.", "sentient", "astral", "actions", "life.", "room", "new", "mistakes.", "mind", "\"ex\"", "off-color", "place", "life,", "family", "psychic", "biggest"], "Pink": ["Diamond,"], "trip": ["to"], "alien": ["moon"], "of": ["ice-cream", "some", "the", "his", "shape", "an", "video", "years", "birthdays", "control", "sword-fighting", "herself.", "summer", "watermelons", "gem", "Lapis.", "Steven's", "thunderstorms", "how", "baseball.", "misadventures", "fun", "Lion's", "a", "Rubies", "space.", "friends.", "wrestling", "Rose's", "Sadie's", "Pink", "Pearl's"], "upset": ["over"], "old": ["and", "for", "feud"], "surprise": ["for"], "Donut.": [""], "Sapphire": ["again."], "Sugilite,": ["Steven"], "rescue": ["the"], "Lars'": ["body."], "bandmate,": ["HIMSELF!"], "Bill": ["Dewey"], "Jasper": ["at"], "together.": [""], "tears": ["accidentally"], "show.": [""], "way.": [""], "sandwich,": ["Cookie"], "documentary": ["for"], "working": ["a"], "effects.": [""], "vision": ["to", "from"], "things": ["spiral", "get"], "spaceship": ["from"], "about": ["paranormal", "the", "his", "their", "her", "Rose", "returning"], "manager,": ["who"], "her.": ["", "However,"], "find": ["the", "a", "all", "what", "his", "help."], "Amethyst,": ["and"], "joins": ["Amethyst", "Pearl"], "encounter": ["another", "Jasper"], "Spire,": ["Steven"], "outage": ["in"], "While": ["navigating", "visiting", "the", "in"], "Gem": ["corruption", "monster.", "on", "monster,", "monster", "family", "war.", "base", "colony,"], "sucked": ["out"], "shows": ["Steven"], "soon": ["cheers", "begins"], "maze,": ["Steven"], "series": ["of"], "patch": ["of"], "closer": ["to"], "redeeming": ["herself"], "war.": ["However,"], "friendship": ["by", "with"], "off": ["the", "all", "himself", "her", "on", "a", "for"], "investigates": ["the"], "fight": ["on", "with", "off"], "Moon": ["Base,", "Base's"], "participate": ["in"], "Sadie,": ["Steven", "who"], "shocking": ["truth"], "between": ["Steven", "Pizza", "Peridot", "restaurant"], "with": ["supplies", "his", "the", "him.", "Steven", "Steven's", "her", "Ronaldo,", "their", "a", "love", "Rose,", "Pearl's", "Onion's", "Pearl", "an", "Greg", "Jasper,", "Steven,", "Connie", "unintentional", "producer"], "was": ["a"], "theories": ["about"], "Spire": ["was"], "it,": ["and"], "thinks": ["he"], "dream": ["prompts", "involving"], "interferes": ["with"], "key": ["to"], "race": ["in"], "escalates": ["into"], "Cream": ["take", "for"], "reveals": ["that"], "something": ["creepy", "and"], "menacing": ["red"], "pawns": ["off"], "finally": ["tells"], "Rose,": ["hoping"], "actually": ["participating"], "start": ["a"], "test": ["and"], "birthdays": ["they\u2019ve"], "Gems\u2019": ["Temple."], "mission.": [""], "tiny": ["cat"], "do.": [""], "instead": ["has"], "their": ["teenage", "favorite", "first", "sound.", "pursuers.", "manager,"], "planned.": [""], "see": ["the", "into", "each"], "busy.": [""], "toy": ["trade"], "corruption": ["is"], "scary": ["movies"], "engage": ["in"], "runs": ["into"], "brand": ["of"], "episode,": ["Amethyst's", "Steven"], "accompany": ["Steven,"], "visiting": ["an"], "growing": ["up"], "run": ["into", "a", "from"], "hang": ["out"], "sound.": ["They"], "Pearl": ["to", "tries", "wants", "form", "on", "teaches", "and", "stepping", "is", "return", "as", "about", "tells"], "status": ["quo."], "\"Keep": ["Beach"], "many": ["years", "changes"], "finds": ["out", "some", "Lapis"], "answers": ["his"], "everyone": ["together"], "explains": ["how"], "Sadie": ["with", "get", "Killer", "worries"], "dispatch": ["team"], "Sea": ["Spire.", "Spire"], "Mayor": ["Dewey"], "it.\r\n": [""], "same": ["job"], "continues": ["doing", "to"], "faces": ["his"], "met": ["Rose"], "laying": ["on"], "home": ["before"], "into": ["tiny", "magical", "epic", "the", "Rose's", "Ruby", "a", "trouble", "Kevin", "Stevonnie", "Kiki's", "Smoky", "her.", "one", "his"], "lets": ["her"], "discover": ["that", "some"], "recurring": ["dreams"], "lion.": [""], "previous": ["episode,"], "Earth.": ["While"], "learn": ["to", "what"], "help": ["of", "him", "Jamie", "them.\r\n", "Lapis", "her", "Steven"], "be": ["his", "a", "there."], "adventure.": [""], "reach": ["the"], "orbits": ["a"], "perspective.": [""], "thought.": [""], "jungle": ["on"], "Weird\"": ["blog."], "bathroom.": [""], "birthplace": ["\u2013"], "Jasper.": ["To"], "going": ["on"], "learns": ["the", "that"], "most": ["harrowing"], "reunites": ["Greg"], "disappearing": ["from"], "thing": ["that"], "mind": ["when"], "mystery.": [""], "wakes": ["up,"], "beloved": ["book"], "corrupted": ["gem", "Gem"], "wants": ["to"], "some": ["of", "alone", "growing", "fun.", "time", "unusual", "homeless"], "shattering": ["of"], "work": ["on"], "middle": ["of"], "Cluster.": [""], "thunderstorms": ["and"], "out.": [""], "an": ["ancient", "underground", "upcoming", "out-of-state", "act", "old-fashioned", "old", "elusive", "alien", "abandoned", "adventure."], "use": ["his", "her"], "dad": ["to"], "take": ["Connie", "Steven", "a", "off", "to"], "Base's": ["airlock,"], "holographic": ["version"], "However,": ["Steven", "he", "Gem", "it", "things", "Peridot"], "along": ["at", "with"], "feeling": ["too"], "Ronaldo": ["investigates", "sets", "sees"], "Pearl.": [""], "ancestor,": ["with"], "worries": ["about"], "projection": ["ability", "to"], "family.": [""], "sneak": ["into"], "together": ["and", "into", "to", "for"], "big": ["surprise"], "hard": ["time"], "desert.": [""], "struggles": ["to"], "roller": ["coasters."], "secret": ["team", "group", "she"], "suddenly": ["return,"], "returning": ["to"], "droid": ["from"], "tell": ["her"], "decision.": [""], "Homeworld,": ["Lapis"], "wild,": ["violent"], "spaceship.": [""], "unable": ["to"], "in": ["order", "the", "an", "town,", "a", "by", "Beach", "to", "his", "someone.", "attempting", "Lars'", "another", "Empire", "there,"], "Backpack": ["with"], "live": ["with", "in"]} \ No newline at end of file diff --git a/data/titles.json b/data/titles.json new file mode 100644 index 0000000..f9f9d59 --- /dev/null +++ b/data/titles.json @@ -0,0 +1 @@ +{"": ["Gem", "Laser", "Cheeseburger", "Together", "Frybo", "Cat", "Bubble", "Serious", "Tiger", "Steven's", "Arcade", "Giant", "So", "Lars", "Onion", "Steven", "Lion", "Beach", "Rose's", "Coach", "Joking", "Monster", "An", "Mirror", "Ocean", "House", "Space", "Secret", "Island", "Keep", "Fusion", "Garnet's", "Watermelon", "Warp", "Alone", "The", "Future", "On", "Horror", "Winter", "Maximum", "Marble", "Political", "Jail", "Full", "Open", "Joy", "Say", "Story", "Shirt", "Love", "Reformed", "Sworn", "Rising", "Keeping", "We", "Chille", "Cry", "Keystone", "Historical", "Friend", "Nightmare", "Sadie's", "Catch", "When", "Back", "Too", "It", "Message", "Log", "Super", "Same", "Barn", "Hit", "Drop", "Mr.", "Restaurant", "Kiki's", "Greg", "Crack", "Bismuth", "Beta", "Earthlings", "Bubbled", "Know", "Buddy's", "Mindful", "Last", "Three", "Adventures", "That", "Storm", "Rocknaldo", "Room", "Doug", "Are", "I", "Stuck", "Off", "Lars'", "Dewey", "Gemcation", "Raising", "Sadie", "Kevin", "Jungle", "Your", "Pool", "Letters", "Can't", "A", "Now", "What's", "Made", "Reunited", "Legs", "Familiar", "Escapism", "Battle", "TBA"], "Marble": ["Madness"], "Drift": [""], "The": ["Movie", "Test", "Message", "Return", "Answer", "New", "Kindergarten", "Zoo", "Good", "Trial", "Big", "Question"], "Motel": [""], "Tiger": ["Millionaire", "Philanthropist"], "Far": [""], "Colors": [""], "Boy": ["Zoltron"], "Short": ["to"], "I": ["Am"], "Mom": [""], "Fusion": ["Cuisine", ""], "Message": ["", "Received"], "Hunt": [""], "Mates": [""], "Talk": [""], "Floats": [""], "Kiss": [""], "Legs": ["From"], "Laser": ["Light"], "Fingers": [""], "Heist": [""], "Beat": ["Dad"], "Need": ["to"], "Mine": [""], "Trade": [""], "Battle": ["of"], "TBA": [""], "You": ["My"], "Greg": ["", "the"], "Dad?": [""], "Only": ["Falling"], "Millionaire": [""], "Problem?": [""], "Room": ["", "for"], "Keystone": ["Motel"], "Political": ["Power"], "Your": ["Fusion", "Mother", "Problem?"], "Buddy's": ["Book"], "Adventures": ["in"], "Chille": ["Tid"], "Mindful": ["Education"], "Frybo": [""], "Ship": [""], "Glow": [""], "Club": [""], "Rocknaldo": [""], "Cuisine": [""], "Received": [""], "Shirt": ["Club"], "Last": ["One"], "Tid": [""], "Beta": [""], "and": ["the", "Release", "a", "Mine", "Mind"], "Kid": [""], "Too": ["Far", "Short"], "Letters": ["", "to"], "Crystal": ["Gems"], "Cannon": [""], "Stevens": [""], "Guest": [""], "Birthdays": [""], "Keep": ["Beach"], "Party": [""], "Gem": ["Glow", "", "Drill", "Hunt", "Harvest", "Heist"], "Earthlings": [""], "Movie": [""], "Barn": ["", "Mates"], "Run": [""], "Are": ["You"], "vs.": ["Amethyst"], "Dream": [""], "Bismuth": [""], "Monster": ["Buddies", "Reunion"], "Zoo": [""], "Alone": ["Together", "at", ""], "Capacity": [""], "Been": ["Great"], "A": ["Single"], "Birthday": [""], "Baby": [""], "Backpack": [""], "From": ["Here"], "Adventure": [""], "Drop": ["Beat"], "Test": [""], "Tour": [""], "a": ["Baby"], "Friend": ["", "Ship"], "Trial": [""], "Great": [""], "Breakfast": [""], "Island": ["Adventure", ""], "Maximum": ["Capacity"], "Historical": ["Friction"], "Break": [""], "4:": ["Alternate"], "Now": ["We're"], "Team": [""], "Warp": ["Tour"], "Weird!": [""], "Single": ["Pale"], "Uncle": [""], "Diamond": [""], "Education": [""], "Will": ["Be"], "Video": [""], "Lars'": ["Head"], "Log": ["Date"], "Delivery": ["Service"], "Beach": ["Party", "City"], "Reunited": [""], "Disclosure": [""], "Honor": [""], "Cat": ["Fingers"], "Cry": ["for"], "Return": [""], "Space": ["Race"], "Hopping": [""], "Reformed": [""], "Full": ["Disclosure"], "15": ["2"], "Same": ["Old"], "to": ["Video", "the", "Talk", "Ride", "Lars", "Homeworld"], "Old": ["World"], "An": ["Indirect"], "Back": ["to", ""], "Restaurant": ["Wars"], "Steven": ["", "the", "and", "Floats", "vs."], "Stars": [""], "Zoltron": [""], "Cheeseburger": ["Backpack"], "Light": ["Cannon", "Distortion"], "Rains": [""], "2": [""], "Fighter": [""], "Hit": ["the"], "What's": ["Your"], "Wins": [""], "Hospital": [""], "Song": [""], "Help": [""], "Big": ["Show"], "Ending": [""], "Giant": ["Woman"], "Rose": [""], "Cool": ["Kids"], "Rising": ["Tides/Crashing"], "Jungle": ["Moon"], "Skies": [""], "Indirect": ["Kiss"], "Know": ["Your"], "it": ["Together"], "Storm": ["in"], "3:": ["Straight"], "Lion": ["", "2:", "3:", "4:"], "of": ["Beach", "the", "Honor", "Heart"], "Onion": ["Trade", "Friend", "Gang"], "We're": ["Only"], "Sea": [""], "All": [""], "Serious": ["Steven"], "Could've": ["Been"], "Kiki's": ["Pizza"], "My": ["Dad?", "Mom"], "Together": ["Breakfast", "", "Alone"], "Arcade": ["Mania"], "the": ["Cool", "Sword", "Stevens", "Run", "Barn", "Diamond", "Babysitter", "Whip", "Moon", "Room", "Kindergarten", "Stars"], "Drill": [""], "at": ["Sea"], "House": ["Guest"], "Coach": ["Steven"], "Bubbled": [""], "Ruby": [""], "Raising": ["the"], "Lars": ["and", "", "of"], "Mirror": ["Gem"], "Gang": [""], "Story": ["for"], "Reunion": [""], "Three": ["Gems"], "Rose's": ["Room", "Scabbard"], "Race": [""], "Show": [""], "Garnet's": ["Universe"], "Moon": [""], "Horror": ["Club"], "7": ["15"], "Harvest": [""], "Winter": ["Forecast"], "Woman": [""], "Release": [""], "Kids": [""], "Stuck": ["Together"], "Gems": ["and", ""], "in": ["Light", "the"], "Can't": ["Go"], "Sword": ["Fighter", ""], "Distortion": [""], "Pizza": ["Delivery"], "Familiar": [""], "Whip": [""], "Pale": ["Rose"], "One": ["Out"], "Sadie": ["Killer"], "Service": [""], "Open": ["Book"], "Off": ["Colors"], "Buddies": [""], "Head": [""], "Good": ["Lars"], "Forecast": [""], "Nightmare": ["Hospital"], "Mother": ["and"], "Keeping": ["it"], "Bubble": ["Buddies"], "Straight": ["to"], "Victim": [""], "Watermelon": ["Steven", "Island"], "Sadie's": ["Song"], "Catch": ["and"], "That": ["Will"], "Future": ["Vision", "Boy"], "Crack": ["the"], "Mania": [""], "Say": ["Uncle"], "New": ["Lars", "Crystal"], "We": ["Need"], "Kevin": ["Party"], "Universe": [""], "Be": ["All"], "Super": ["Watermelon"], "Mr.": ["Greg"], "Wars": [""], "Mind": [""], "Secret": ["Team"], "World": [""], "Vision": [""], "Pool": ["Hopping"], "Kindergarten": ["Kid", ""], "Tides/Crashing": ["Skies"], "Many": ["Birthdays"], "Gemcation": [""], "Power": [""], "When": ["It"], "Joy": ["Ride"], "Made": ["of"], "It": ["Rains", "Could've"], "Jail": ["Break"], "Love": ["Letters"], "City": ["Weird!", "Drift", ""], "Answer": [""], "2:": ["The"], "Friction": [""], "Out": ["of", ""], "Alternate": ["Ending"], "Dewey": ["Wins"], "Ocean": ["Gem"], "Book": [""], "Apart": [""], "Philanthropist": [""], "Scabbard": [""], "for": ["Steven", "Help", "Ruby"], "So": ["Many"], "Killer": [""], "Madness": [""], "Question": [""], "Here": ["to"], "Heart": ["and"], "Babysitter": [""], "Go": ["Back"], "Doug": ["Out"], "Falling": ["Apart"], "Dad": [""], "Escapism": [""], "Steven's": ["Lion", "Birthday", "Dream"], "Homeworld": [""], "Joking": ["Victim"], "Ride": [""], "Amethyst": [""], "Sworn": ["to"], "Am": ["My"], "On": ["the"], "Date": ["7"]} \ No newline at end of file diff --git a/markov.py b/markov.py new file mode 100644 index 0000000..a43090c --- /dev/null +++ b/markov.py @@ -0,0 +1,42 @@ +import random,json +class Chain: + def __init__(self): + self.map = {} + + def addWord(self,lastWord,word): + if lastWord in self.map and not word in self.map[lastWord]: + self.map[lastWord].append(word) + elif not lastWord in self.map: + self.map[lastWord] = [word] + + def train(self,sentance): + words = sentance.split(" ") + lastWord = words.pop(0) + self.addWord("",lastWord) + for word in words: + self.addWord(lastWord,word) + lastWord = word + self.addWord(lastWord,"") + + def generate(self): + lastWord = random.choice(self.map[""]) + sentence = lastWord + while lastWord != "": + word = random.choice(self.map[lastWord]) + sentence += " " + word + lastWord = word + return sentence[:-1] + + def to_json(self): + return json.dumps(self.map) + + @classmethod + def from_json(cls,jsonstr): + ret = cls() + ret.map = json.loads(jsonstr) + return ret + +def addLinesFromFile(chain,filename): + with open(filename) as f: + for line in f.readlines(): + chain.train(line.rstrip()) diff --git a/markovuniverse.py b/markovuniverse.py new file mode 100644 index 0000000..fe42f81 --- /dev/null +++ b/markovuniverse.py @@ -0,0 +1,17 @@ +import markov + +def chainFromFile(filename): + with open(filename) as f: + return markov.Chain.from_json(f.read()) + +titles = chainFromFile("data/titles.json") +synopses = chainFromFile("data/synopses.json") + +def new_episode(): + title = titles.generate() + synopsis = synopses.generate() + return (title,synopsis) + +if __name__=="__main__": + details = new_episode() + print("New episode:\n{} - {}".format(*details))