import requests


def aggregate_urns(urnlist):
    """Sum up word frequencies across urns"""
    
    if isinstance(urnlist[0], list):
        urnlist = [u[0] for u in urnlist]
    r = requests.post("https://api.nb.no/ngram/book_aggregates", json={'urns':urnlist})
    return r.json()