'Converts a list of words to a list
of word ids. Use unk_sym if a word is not
known.'

def indices_to_words(self, seq, exclude_end_sym=True):

    def convert():
        for word_index in seq:
            if (word_index > len(self.idx_to_str)):
                raise ValueError('Word    index    is    too    large    for    the    model    vocabulary!')
            if ((not exclude_end_sym) or (word_index != self.eos_sym)):
                (yield self.idx_to_str[word_index])
    return list(convert())
