def load_vocab(self, vocab_file):
    """Load vocab from file.

    Args:
      vocab_file: vocab file

    Returns:
      a mapping from word to id
    """
    word2id = dict()
    with gfile.GFile(vocab_file, 'r') as f_in:
      for line in tqdm(f_in):
        word = json.loads(line)
        assert word not in word2id
        word2id[word] = len(word2id)
    return word2id
Load vocab from file.

    Args:
      vocab_file: vocab file

    Returns:
      a mapping from word to id
    
language/emql/data_loader.py