from typing import Counter


def get_doc_outgroup(doc):

    """
    returns a dictionary containing a count of the outgroup terms mentioned within the document
    format = {"outgroup term" : number of occurances}
    """

    group = [feature.lower_.title() for feature in doc._.concepts if feature._.ATTRIBUTE in ["outgroup"]]
    
    return {k: v for k, v in sorted(dict(Counter(group)).items(), key=lambda item: item[1], reverse = True)}