(self, all_labels)
Prepare label vocab
Prepare label vocab
Prepare label vocab
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]))
def prepare_label_vocab ( self , all_labels ) : 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 ] ) )