code: def build_vocab_generator(
      self, generators: List[CorpusGenerator]
  ) -> None:
      from kashgari.utils import MultiLabelBinarizer
  
      if self.vocab2idx:
          return
  
      vocab2idx: Dict[str, int] = {}
      token2count: Dict[str, int] = {}
      for generator in generators:
          if self.multi_label:
              for _, label in tqdm.tqdm(
                  generator,
                  desc="Preparing classification label vocab dict",
              ):
                  for token in label:
                      count = token2count.get(token, 0)
                      token2count[token] = count + 1
          else:
              for _, label in tqdm.tqdm(
                  generator,
                  desc="Preparing classification label vocab dict",
              ):
                  count = token2count.get(label, 0)
                  token2count[label] = count + 1
  
      sorted_token2count = sorted(
          token2count.items(), key=operator.itemgetter(1), reverse=True
      )
      token2count = collections.OrderedDict(sorted_token2count)
  
      for token, token_count in token2count.items():
          if token not in vocab2idx:
              vocab2idx[token] = len(vocab2idx)
      self.vocab2idx = vocab2idx
      self.idx2vocab = dict([(v, k) for k, v in self.vocab2idx.items()])
      self.multi_label_binarizer = MultiLabelBinarizer(self.vocab2idx)
  
file_path: Kashgari/kashgari/processors/class_processor.py
imports: import collections
  import operator
  from typing import List, Union, Dict, Optional, Any, Tuple
  import numpy
  import tqdm
  from kashgari.generators import CorpusGenerator
  from kashgari.processors.abc_processor import ABCProcessor
  from kashgari.types import TextSamplesVar
label_desc: Use image node_id 3 for calling the ClassificationProcessor obj's underlying member method code with example usage: obj.build_vocab_generator(generators) without return types