'Converts a space-separated string of tokens to a list of ids.'

def encode(self, sentence):

    ret = [self._token_to_id[tok] for tok in sentence.strip().split()]
    return (ret[::(-1)] if self._reverse else ret)
