class_docstr: A wrapper around the output of the tf.Transform.
docstr: Returns the vocabulary file path created in the preprocessing function.
  
  `vocab_filename` must either be (i) the name used as the vocab_filename
  argument to tft.compute_and_apply_vocabulary / tft.vocabulary or (ii) the
  key used in tft.annotate_asset.
  
  When a mapping has been specified by calls to tft.annotate_asset, it will be
  checked first for the provided filename. If present, this filename will be
  used directly to construct a path.
  
  If the mapping does not exist or `vocab_filename` is not present within it,
  we will default to sanitizing `vocab_filename` and searching for files
  matching it within the assets directory.
  
  In either case, if the constructed path does not point to an existing file
  within the assets subdirectory, we will return a None.
  
  Args:
    vocab_filename: The vocabulary name to lookup.
docstr_tok: ["Returns","the","vocabulary","file","path","created","in","the","preprocessing","function",".","`","vocab_filename","`","must","either","be","(","i",")","the","name","used","as","the","vocab_filename","argument","to","tft.compute_and_apply_vocabulary","\/","tft.vocabulary","or","(","ii",")","the","key","used","in","tft.annotate_asset",".","When","a","mapping","has","been","specified","by","calls","to","tft.annotate_asset",",","it","will","be","checked","first","for","the","provided","filename",".","If","present",",","this","filename","will","be","used","directly","to","construct","a","path",".","If","the","mapping","does","not","exist","or","`","vocab_filename","`","is","not","present","within","it",",","we","will","default","to","sanitizing","`","vocab_filename","`","and","searching","for","files","matching","it","within","the","assets","directory",".","In","either","case",",","if","the","constructed","path","does","not","point","to","an","existing","file","within","the","assets","subdirectory",",","we","will","return","a","None",".","Args",":","vocab_filename",":","The","vocabulary","name","to","lookup","."]
code: def vocabulary_file_by_name(
      self, vocab_filename: str
  ) -> Optional[str]:
      """Returns the vocabulary file path created in the preprocessing function.
  
      `vocab_filename` must either be (i) the name used as the vocab_filename
      argument to tft.compute_and_apply_vocabulary / tft.vocabulary or (ii) the
      key used in tft.annotate_asset.
  
      When a mapping has been specified by calls to tft.annotate_asset, it will be
      checked first for the provided filename. If present, this filename will be
      used directly to construct a path.
  
      If the mapping does not exist or `vocab_filename` is not present within it,
      we will default to sanitizing `vocab_filename` and searching for files
      matching it within the assets directory.
  
      In either case, if the constructed path does not point to an existing file
      within the assets subdirectory, we will return a None.
  
      Args:
        vocab_filename: The vocabulary name to lookup.
      """
      mapping_path = os.path.join(
          self._transformed_metadata_dir, self.ASSET_MAP
      )
  
      mapping = {}
      if tf.io.gfile.exists(mapping_path):
          with tf.io.gfile.GFile(mapping_path) as f:
              mapping = json.loads(f.read())
              if vocab_filename in mapping:
                  vocab_path = os.path.join(
                      self.transform_savedmodel_dir,
                      tf.saved_model.ASSETS_DIRECTORY,
                      mapping[vocab_filename],
                  )
                  if tf.io.gfile.exists(vocab_path):
                      return vocab_path
  
      prefix = os.path.join(
          self.transform_savedmodel_dir,
          tf.saved_model.ASSETS_DIRECTORY,
          sanitized_vocab_filename(filename=vocab_filename),
      )
      files = tf.io.gfile.glob(prefix) + tf.io.gfile.glob(
          "{}.tfrecord.gz".format(prefix)
      )
      if not files:
          return None
      if len(files) != 1:
          raise ValueError(
              "Found too many vocabulary files: {}".format(files)
          )
      return files[0]
  
imports: import json
  import os
  from typing import Any, Dict, List, Mapping, Optional
  import numpy
  import tensorflow
  from tensorflow_transform import common
  from tensorflow_transform import common_types
  from tensorflow_transform import graph_tools
  from tensorflow_transform.analyzers import sanitized_vocab_filename
  from tensorflow_transform.keras_lib import tf_keras
  from tensorflow_transform.saved import saved_transform_io
  from tensorflow_transform.saved import saved_transform_io_v2
  from tensorflow_transform.tf_metadata import dataset_metadata
  from tensorflow_transform.tf_metadata import metadata_io
  from tensorflow_transform.tf_metadata import schema_utils
  from tensorflow.python.framework import ops
  from tensorflow.tools.docs import doc_controls
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 8 for calling the TFTransformOutput obj's underlying member method code with example usage: obj.vocabulary_file_by_name(vocab_filename) and returns: files, None, vocab_path