def rank_authors_by_publications(author_pub, weighted=True, equal_contribution=True):
    """
    :param author_pub: the output of publications_per_author()
    :param weighted: if True, rank the authors by weighted publication scores; otherwise, by publication counts.
    :param equal_contribution: if True, the contribution of each paper is equally divided by the # of authors.
    :return: the ranked list of authors with their publication scores in descending order.
    """
    def score(pubs):
        if equal_contribution:
            return sum(pub[2]/pub[3] for pub in pubs) if weighted else sum(1/pub[3] for pub in pubs)
        else:
            return sum(pub[2] for pub in pubs) if weighted else len(pubs)   # pub[2]: weight

    return sorted([(k, score(v)) for k, v in author_pub.items()], key=lambda x: x[1], reverse=True)