예제 #1
0
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
예제 #2
0
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