code: def _approximate_vocabulary_analyzer_nodes(
      analyzer_inputs: Collection[tf.Tensor],
      input_dtype: tf.dtypes.DType,
      vocab_filename: str,
      top_k: int,
      store_frequency: bool,
      file_format: common_types.VocabularyFileFormatType,
      vocabulary_key: str,
      reserved_tokens: Optional[Union[Sequence[str], tf.Tensor]] = None,
  ) -> common_types.TemporaryAnalyzerOutputType:
      """Internal helper for analyzing vocab. See `vocabulary` doc string."""
      # TODO(b/208879020): Add vocabulary size annotation for this analyzer.
      analyzers.register_vocab(
          vocab_filename,
          vocabulary_key=vocabulary_key,
          file_format=file_format,
      )
  
      outputs_value_nodes = analyzers.apply_cacheable_combine_operation(
          _VocabularyCombiner(
              top_k,
              input_dtype,
              output_pylist=reserved_tokens is not None,
          ),
          *analyzer_inputs,
      )
  
      flattened_outputs_value_node = nodes.apply_operation(
          analyzer_nodes.FlattenLists, *outputs_value_nodes
      )
  
      extra_apply_order_and_write_op_args = []
      if reserved_tokens is not None:
          tf_utils.register_vocabulary_reserved_tokens(
              vocab_filename, reserved_tokens
          )
          extra_apply_order_and_write_op_args.append(
              nodes.apply_operation(
                  analyzer_nodes.ExtractVocabularyReservedTokens,
                  name=vocab_filename,
              )
          )
  
      vocab_filename_node = nodes.apply_operation(
          analyzer_nodes.VocabularyOrderAndWrite,
          flattened_outputs_value_node,
          *extra_apply_order_and_write_op_args,
          vocab_filename=vocab_filename,
          store_frequency=store_frequency,
          input_dtype=input_dtype,
          file_format=file_format,
          fingerprint_shuffle=False,
          input_is_sorted=True,
      )
  
      return analyzer_nodes.wrap_as_tensor(vocab_filename_node)
  
imports: from typing import Any, Collection, List, Optional, Tuple, Union, Iterable, Sequence
  import numpy
  import pyarrow
  import tensorflow
  from tensorflow_transform import analyzer_nodes
  from tensorflow_transform import analyzers
  from tensorflow_transform import common
  from tensorflow_transform import common_types
  from tensorflow_transform import nodes
  from tensorflow_transform import tf_utils
  from tfx_bsl import sketches
  from tfx_bsl.types import tfx_namedtuple
  from typing_extensions import Protocol
label_desc: Use image node_id 5 for calling a global function with example usage: _approximate_vocabulary_analyzer_nodes(analyzer_inputs, input_dtype, vocab_filename, top_k, store_frequency, file_format, vocabulary_key, reserved_tokens) and returns: analyzer_nodes