code: def tokenize_masked_words(
      batch, tokenizer, max_num_tokens, prepend_bos, append_eos
  ):
      """Tokenize masked words and add them to the batch in `masked_targets` field."""
  
      caption_string = batch["mwp_caption_string"][0]
      word_mask = batch["mwp_word_mask"]
      masked_word_strings = tf.boolean_mask(
          tf.strings.split(caption_string), word_mask
      )
  
      tokenized = tokenizer.string_tensor_to_indices(
          masked_word_strings,
          prepend_bos=prepend_bos,
          append_eos=append_eos,
          max_num_tokens=max_num_tokens,
      )
  
      batch["masked_targets"] = tokenized
  
      del batch["mwp_word_mask"], batch["mwp_caption_string"]
  
      return batch
  
imports: import functools
  from typing import Any, Dict, Optional, Sequence
  from absl import logging
  from dmvr import builders
  from dmvr import processors
  from dmvr import tokenizers
  import numpy
  from scenic.projects.mbt.datasets.dataset_utils import _decode_spectrogram
  from scenic.projects.mbt.datasets.dataset_utils import apply_specaugment
  import tensorflow
label_desc: Use image node_id 6 for calling a global function with example usage: tokenize_masked_words(batch, tokenizer, max_num_tokens, prepend_bos, append_eos) and returns: batch