import json


def load_vocab(f):
    """Load the vocab from a file.
    """
    json_dict = json.loads(f.read())

    vocab = {int(k): v for k, v in json_dict.items()}
    vocab.update({v: k for k, v in vocab.items()})
    return vocab