def read_in_akas(entitysymbols):
    """Read in alias to QID mappings and generates a QID to list of alternate names.

    Args:
        entitysymbols: entity symbols

    Returns: dictionary of QID to type names
    """
    # take the first type; UNK type is 0
    qid2aliases = {}
    for al in entitysymbols.get_all_aliases():
        for qid in entitysymbols.get_qid_cands(al):
            if qid not in qid2aliases:
                qid2aliases[qid] = set()
            qid2aliases[qid].add(al)
    # Turn into sets for dumping
    for qid in qid2aliases:
        qid2aliases[qid] = list(qid2aliases[qid])
    return qid2aliases