'Initialize vocabulary.
Args:
filename: Vocabulary file name.'

def __init__(self, filename):

    self._id_to_word = []
    self._word_to_id = {}
    self._unk = (-1)
    self._bos = (-1)
    self._eos = (-1)
    with tf.gfile.Open(filename) as f:
        idx = 0
        for line in f:
            word_name = line.strip()
            if (word_name == '<S>'):
                self._bos = idx
            elif (word_name == '</S>'):
                self._eos = idx
            elif (word_name == '<UNK>'):
                self._unk = idx
            if (word_name == '!!!MAXTERMID'):
                continue
            self._id_to_word.append(word_name)
            self._word_to_id[word_name] = idx
            idx += 1
