def word_to_char_ids(word, word_length):
  """Convert a string to a padded vector of character ids.

  If the true length of the word is less than `word_length`, padding is added.
  If the true length of the word is greater than `word_length`, additional bytes
  are ignored.

  Args:
    word: <string> []
    word_length: Number of bytes to include per word.

  Returns:
    char_ids: <int32> [word_length]
  """
  char_ids = tf.to_int32(tf.decode_raw(word, tf.uint8))[:word_length - 2]
  padding = tf.fill([word_length - tf.shape(char_ids)[0] - 2], PAD_CHAR)
  char_ids = tf.concat([[BOW_CHAR], char_ids, [EOW_CHAR], padding], 0)
  char_ids.set_shape([word_length])
  return char_ids
Convert a string to a padded vector of character ids.

  If the true length of the word is less than `word_length`, padding is added.
  If the true length of the word is greater than `word_length`, additional bytes
  are ignored.

  Args:
    word: <string> []
    word_length: Number of bytes to include per word.

  Returns:
    char_ids: <int32> [word_length]
  
language/common/inputs/char_utils.py