def get_hosts(year): '''Hosts is a list of one or more strings. Do NOT change the name of this function or what it returns.''' path = "gg" + year + ".json" data = api.read(path) data["pp_text"] = api.preprocess_data(data["text"]) hosts = api.find_hosts(data) return hosts
def get_awards(year): '''Awards is a list of strings. Do NOT change the name of this function or what it returns.''' path = "gg" + year + ".json" data = api.read(path) data["pp_text"] = api.preprocess_data(data["text"]) awards = api.find_awards(data) return awards
def main(): '''This function calls your program. Typing "python gg_api.py" will run this function. Or, in the interpreter, import gg_api and then run gg_api.main(). This is the second thing the TA will run when grading. Do NOT change the name of this function or what it returns.''' year = sys.argv[1] path = "gg" + year + ".json" data = api.read(path) data["pp_text"] = api.preprocess_data(data["text"]) if year == "2013" or year == "2015": api.output(data, OFFICIAL_AWARDS_1315) else: api.output(data, OFFICIAL_AWARDS_1819) return
def get_winner(year): '''Winners is a dictionary with the hard coded award names as keys, and each entry containing a single string. Do NOT change the name of this function or what it returns.''' path = "gg" + year + ".json" data = api.read(path) data["pp_text"] = api.preprocess_data(data["text"]) if year == "2013" or year == "2015": allData = api.process_award(data, OFFICIAL_AWARDS_1315) else: allData = api.process_award(data, OFFICIAL_AWARDS_1819) winner = {} for k, v in allData.items(): winner[k] = v["Winners"] return winner
def get_nominees(year): '''Nominees is a dictionary with the hard coded award names as keys, and each entry a list of strings. Do NOT change the name of this function or what it returns.''' path = "gg" + year + ".json" data = api.read(path) data["pp_text"] = api.preprocess_data(data["text"]) if year == "2013" or year == "2015": allData = api.process_award(data, OFFICIAL_AWARDS_1315) else: allData = api.process_award(data, OFFICIAL_AWARDS_1819) nominees = {} for k, v in allData.items(): nominees[k] = v["Nominees"] return nominees