code: def _tokenize_review(review):
      """Tokenize the reviews by spliting the reviews.
  
      Constructing a vocabulary. Map the words to their frequency index in the
      vocabulary.
  
      Args:
        review: tensors containing the reviews. (batch_size/None, 1)
  
      Returns:
        Tokenized and padded review tensors. (batch_size/None, _MAX_LEN)
      """
      review_sparse = tf.strings.split(
          tf.reshape(review, [-1])
      ).to_sparse()
      # tft.apply_vocabulary doesn't reserve 0 for oov words. In order to comply
      # with convention and use mask_zero in keras.embedding layer, set oov value
      # to _VOCAB_SIZE and padding value to -1. Then add 1 to all the tokens.
      review_indices = tft.compute_and_apply_vocabulary(
          review_sparse, default_value=_VOCAB_SIZE, top_k=_VOCAB_SIZE
      )
      dense = tf.sparse.to_dense(review_indices, default_value=-1)
      # TFX transform expects the transform result to be FixedLenFeature.
      padding_config = [[0, 0], [0, _MAX_LEN]]
      dense = tf.pad(dense, padding_config, "CONSTANT", -1)
      padded = tf.slice(dense, [0, 0], [-1, _MAX_LEN])
      padded += 1
      return padded
  
file_path: tfx/tfx/examples/imdb/imdb_utils_native_keras.py
imports: from typing import List
  import absl
  import tensorflow
  from tensorflow import keras
  import tensorflow_transform
  from tfx.components.trainer.fn_args_utils import DataAccessor
  from tfx.components.trainer.fn_args_utils import FnArgs
  from tfx_bsl.tfxio import dataset_options
label_desc: Use image node_id 2 for calling a global function with example usage: _tokenize_review(review) and returns: padded