code: def _make_construct_vocabulary_table_function(
      x, file_format, num_oov_buckets, default_value, store_frequency
  ):
      """Defines a function to construct a vocabulary lookup table."""
  
      def construct_table(asset_filepath):
          if file_format == "tfrecord_gzip":
              initializer = (
                  tf_utils.make_tfrecord_vocabulary_lookup_initializer(
                      asset_filepath,
                      x.dtype,
                      return_indicator_as_value=False,
                      has_indicator=store_frequency,
                  )
              )
          elif file_format == "text":
              key_index = (
                  1
                  if store_frequency
                  else tf.lookup.TextFileIndex.WHOLE_LINE
              )
              kwargs = {"delimiter": " "} if store_frequency else {}
              initializer = tf.lookup.TextFileInitializer(
                  asset_filepath,
                  key_dtype=x.dtype,
                  key_index=key_index,
                  value_dtype=tf.int64,
                  value_index=tf.lookup.TextFileIndex.LINE_NUMBER,
                  **kwargs,
              )
          else:
              raise ValueError(
                  '"{}" is not an accepted file_format. It should be one of: {}'.format(
                      file_format,
                      analyzers.ALLOWED_VOCABULARY_FILE_FORMATS,
                  )
              )
  
          if num_oov_buckets > 0:
              table = tf.lookup.StaticVocabularyTable(
                  initializer,
                  num_oov_buckets=num_oov_buckets,
                  lookup_key_dtype=x.dtype,
              )
          else:
              table = tf.lookup.StaticHashTable(
                  initializer, default_value=default_value
              )
          return table
  
      return construct_table
  
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 20 for calling a global function with example usage: _make_construct_vocabulary_table_function(x, file_format, num_oov_buckets, default_value, store_frequency) and returns: construct_table, table