def frequency_to_probability(frequency_map, decorator=lambda f: f):
    """Transform a ``frequency_map`` into a map of probability using the sum of all frequencies as the total.

    Example:
        >>> frequency_to_probability({'a': 2, 'b': 2})
        {'a': 0.5, 'b': 0.5}

    Args:
        frequency_map (dict): The dictionary to transform
        decorator (function): A function to manipulate the probability

    Returns:
        Dictionary of ngrams to probability
    """
    total = sum(frequency_map.values())
    return {k: decorator(v / total) for k, v in frequency_map.items()}