def load_vocab(fname):
    """
    load word dict

    Args:
        fname (str): filename of the vocav file
    
    Returns:
        dict: word dict
    """
    word2idx = {}
    with open(fname, "r") as f:
        for line in f:
            pair = line.split()
            word2idx[pair[0]] = int(pair[1])
    return word2idx