'Initialize from a file or list, one token per line.'

def __init__(self, vocab_filename, reverse=False, vocab_list=None, num_reserved_ids=NUM_RESERVED_TOKENS):

    super(TokenTextEncoder, self).__init__(num_reserved_ids=num_reserved_ids)
    self._reverse = reverse
    if vocab_filename:
        self._init_vocab_from_file(vocab_filename)
    else:
        assert (vocab_list is not None)
        self._init_vocab_from_list(vocab_list)
