class_docstr: Base Preparer class for nlp
class_docstr_tok: ["Base","Preparer","class","for","nlp"]
docstr: Prepare label vocab
docstr_tok: ["Prepare","label","vocab"]
code: def prepare_label_vocab(self, all_labels):
      """Prepare label vocab"""
      for i in range(self.output_num):
          if (
              os.path.exists(self.label_vocab_file_paths[i])
              and self.use_custom_vocab
          ):
              logging.info(
                  "Reuse label vocab file: {}".format(
                      self.label_vocab_file_paths[i]
                  )
              )
          else:
              if "vocab" in self.config["data"]["task"]["classes"]:
                  output_index = i if self.multi_output else None
                  prepare_vocab_from_config(
                      self.label_vocab_file_paths[i],
                      self.config,
                      output_index=output_index,
                  )
              else:
                  prepare_vocab(
                      self.label_vocab_file_paths[i],
                      all_labels[i],
                      min_frequency=1,
                      use_default_dict=False,
                  )
              logging.info(
                  "Generate label vocab file: {}".format(
                      self.label_vocab_file_paths[i]
                  )
              )
  
imports: import os
  import math
  from pathlib import Path
  from absl import logging
  import delta.compat
  import numpy
  from delta import utils
  from delta.data.preprocess.utils import prepare_embedding
  from delta.utils.solver.utils.solver_utils import get_session_conf
  from delta.data.preprocess.utils import prepare_vocab
  from delta.data.preprocess.utils import prepare_vocab_from_config
  from delta.data.preprocess.utils import get_pre_process_text_ds_iter
  from delta.data.utils.common_utils import get_file_len
label_desc: Use image node_id 9 for calling the TextPreparer obj's underlying member method code with example usage: obj.prepare_label_vocab(all_labels) without return types