import tensorflow as tf

                   ids_ta.size() + tf.size(encoded_ids)), encoded_ids)
      return i + 1, words, ids_ta

    _, _, ids_ta = tf.while_loop(
        lambda i, *_: i < num_words,
        _WordsToIds,
        loop_vars=(tf.constant(0, tf.int32), words, ids_ta),
        parallel_iterations=30,
        back_prop=False)

    ids = ids_ta.stack()
    return ids, self._TokenToString(ids)
