code: def bag_of_words(
      tokens: tf.SparseTensor,
      ngram_range: Tuple[int, int],
      separator: str,
      name: Optional[str] = None,
  ) -> tf.SparseTensor:
      """Computes a bag of "words" based on the specified ngram configuration.
  
      A light wrapper around tft.ngrams. First computes ngrams, then transforms the
      ngram representation (list semantics) into a Bag of Words (set semantics) per
      row. Each row reflects the set of *unique* ngrams present in an input record.
  
      See tft.ngrams for more information.
  
      Args:
        tokens: a two-dimensional `SparseTensor` of dtype `tf.string` containing
          tokens that will be used to construct a bag of words.
        ngram_range: A pair with the range (inclusive) of ngram sizes to compute.
        separator: a string that will be inserted between tokens when ngrams are
          constructed.
        name: (Optional) A name for this operation.
  
      Returns:
        A `SparseTensor` containing the unique set of ngrams from each row of the
          input. Note: the original order of the ngrams may not be preserved.
      """
      if tokens.get_shape().ndims != 2:
          raise ValueError(
              "bag_of_words requires `tokens` to be 2-dimensional"
          )
      with tf.compat.v1.name_scope(name, "bag_of_words"):
          # First compute the ngram representation, which will contain ordered and
          # possibly duplicated ngrams per row.
          all_ngrams = ngrams(tokens, ngram_range, separator)
          # Then deduplicate the ngrams in each row.
          return deduplicate_tensor_per_row(all_ngrams)
  
imports: import os
  from typing import Any, Callable, Iterable, Optional, Tuple, Union
  import tensorflow
  from tensorflow_transform import analyzers
  from tensorflow_transform import common
  from tensorflow_transform import common_types
  from tensorflow_transform import gaussianization
  from tensorflow_transform import schema_inference
  from tensorflow_transform import tf_utils
  from tfx_bsl.types import tfx_namedtuple
label_desc: Use image node_id 26 for calling a global function with example usage: bag_of_words(tokens, ngram_range, separator, name) and returns: deduplicate_tensor_per_row