code: def testVocabularyWithTableDefinedInPreprocessingFnFeedsSecondAnalyzer(
      self,
  ):
      if self._VocabFormat() != "text":
          raise tft_unit.SkipTest(
              "Test only applicable to text format."
          )
  
      input_data = [
          dict(x=b"bar"),
          dict(x=b"foo"),
          dict(x=b"bar"),
          dict(x=b"bar"),
          dict(x=b"foo"),
      ]
      input_metadata = tft.DatasetMetadata.from_feature_spec(
          {"x": tf.io.FixedLenFeature([], tf.string)}
      )
      expected_data = [
          dict(x=b"bar", x_int=0, x_int_mean=0.4),
          dict(x=b"bar", x_int=0, x_int_mean=0.4),
          dict(x=b"bar", x_int=0, x_int_mean=0.4),
          dict(x=b"foo", x_int=1, x_int_mean=0.4),
          dict(x=b"foo", x_int=1, x_int_mean=0.4),
      ]
      expected_metadata = tft.DatasetMetadata.from_feature_spec(
          {
              "x": tf.io.FixedLenFeature([], tf.string),
              "x_int": tf.io.FixedLenFeature([], tf.int64),
              "x_int_mean": tf.io.FixedLenFeature([], tf.float32),
          }
      )
      expected_vocab_file_contents = [(b"bar"), (b"foo")]
  
      def preprocessing_fn(inputs):
          vocab_path = tft.vocabulary(
              inputs["x"],
              vocab_filename="my_vocab",
              file_format=self._VocabFormat(),
          )
          initializer = tf.lookup.TextFileInitializer(
              vocab_path,
              key_dtype=tf.string,
              key_index=tf.lookup.TextFileIndex.WHOLE_LINE,
              value_dtype=tf.int64,
              value_index=tf.lookup.TextFileIndex.LINE_NUMBER,
          )
          table = tf.lookup.StaticHashTable(
              initializer, default_value=-1
          )
          x_int = table.lookup(inputs["x"])
          x_int_mean = tf.zeros_like(
              x_int, dtype=tf.float32
          ) + tft.mean(x_int)
          return {
              "x": inputs["x"],
              "x_int": x_int,
              "x_int_mean": x_int_mean,
          }
  
      self.assertAnalyzeAndTransformResults(
          input_data,
          input_metadata,
          preprocessing_fn,
          expected_data,
          expected_metadata,
          expected_vocab_file_contents={
              "my_vocab": expected_vocab_file_contents
          },
      )
  
imports: import os
  import apache_beam
  import tensorflow
  import tensorflow_transform
  from tensorflow_transform.beam import analyzer_impls
  from tensorflow_transform.beam import impl
  from tensorflow_transform.beam.tft_beam_io import transform_fn_io
  from tensorflow_transform.beam import tft_unit
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 17 for calling the VocabularyIntegrationTest obj's underlying member method code with example usage: obj.testVocabularyWithTableDefinedInPreprocessingFnFeedsSecondAnalyzer() and returns: dict