def load_w2v_vocab(fname):
    """Load vocabulary file generated by gensim as a dictionary.

    Note that this does not correspond to the gensim vocabulary
    object.

    Parameters
    ----------
    fname: string
      Filename where the w2v model is stored.

    Returns
    -------
    vocab: dict{str: int}
      A dictionary containing the words as keys and their counts as
      values.

    """
    lst = []
    with open(fname, 'r') as f:
        for line in f:
            word, count = line.split()
            lst.append((word, int(count)))
    vocab = dict(lst)
    return vocab