import csv


def load_fsd50k_vocabulary(data_path):
    """Load vocabulary of FSD50K to relate FSD50K labels with AudioSet onthology

    Args:
        data_path (str): Path to the vocabulary file

    Returns:
        * fsd50k_to_audioset (dict): vocabulary to convert FSD50K to AudioSet
        * audioset_to_fsd50k (dict): vocabulary to convert from AudioSet to FSD50K
    """
    fsd50k_to_audioset = {}
    audioset_to_fsd50k = {}
    with open(data_path, "r") as fhandle:
        reader = csv.reader(fhandle, delimiter=",")
        for line in reader:
            fsd50k_to_audioset[line[1]] = line[2]
            audioset_to_fsd50k[line[2]] = line[1]

    return fsd50k_to_audioset, audioset_to_fsd50k