code: def test_get_vocabulary_size_by_name(self, values, expected_size):
      vocab_filename = "vocab"
  
      def preprocessing_fn(inputs):
          tft.vocabulary(inputs["s"], vocab_filename=vocab_filename)
          size = tf.zeros_like(
              inputs["s"], dtype=tf.int64
          ) + tft.experimental.get_vocabulary_size_by_name(
              vocab_filename
          )
          return {"size": size}
  
      input_data_dicts = [dict(s=v) for v in values]
      input_metadata = tft.DatasetMetadata.from_feature_spec(
          {
              "s": tf.io.FixedLenFeature([], tf.string),
          }
      )
      expected_data = [
          {
              "size": expected_size,
          }
      ] * len(values)
      self.assertAnalyzeAndTransformResults(
          input_data_dicts,
          input_metadata,
          preprocessing_fn,
          force_tf_compat_v1=False,
          expected_data=expected_data,
      )
  
file_path: transform/tensorflow_transform/beam/annotators_test.py
imports: import tensorflow
  import tensorflow_transform
  from tensorflow_transform.beam import tft_unit
  from google.protobuf import text_format
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 4 for calling the AnnotatorsTest obj's underlying member method code with example usage: obj.test_get_vocabulary_size_by_name(values, expected_size) and returns: dict