from typing import Dict
from typing import Set


def map_senses_acronym(standard: Dict[str, Dict[str, int]],
                       lenient: bool = False) -> Dict[str, Set[str]]:
    """
    Map: collect senses for each acronym.

    :param standard:
    :param lenient: Whether to consider partial matches (1) as a valid sense.
    :return:
    """
    senses = {}  # type: Dict[str, Set[str]]
    for acronym, expansions in standard.items():
        senses.setdefault(acronym, set())
        for expansion, relevance in expansions.items():
            if relevance == 2 or relevance == 1 and lenient:
                senses[acronym].add(expansion)
    return senses