code: def _check_build_vocab(func: Callable):
      r"""
      A decorator to make sure the indexing is built before used.
  
      :param func: 传入的callable函数
  
      """
  
      @wraps(func)  # to solve missing docstring
      def _wrapper(self, *args, **kwargs):
          if self._word2idx is None or self.rebuild is True:
              self.build_vocab()
          return func(self, *args, **kwargs)
  
      return _wrapper
  
imports: from collections import Counter
  from functools import partial
  from functools import wraps
  from typing import List, Callable, Union
  from fastNLP.core.dataset import DataSet
  from fastNLP.core.utils.utils import Option
  from fastNLP.core.utils.utils import _is_iterable
  from .log import logger
  import io
label_desc: Use image node_id 1 for calling a global function with example usage: _check_build_vocab(func) and returns: _wrapper, func