code: def _indexize(
      data_bundle,
      input_field_names="words",
      target_field_names="target",
  ):
      r"""
      在dataset中的field_name列建立词表，'target'列建立词表，并把词表加入到data_bundle中。
  
      :param ~fastNLP.DataBundle data_bundle:
      :param: str,list input_field_names:
      :param: str,list target_field_names: 这一列的vocabulary没有unknown和padding
      :return:
      """
      if isinstance(input_field_names, str):
          input_field_names = [input_field_names]
      if isinstance(target_field_names, str):
          target_field_names = [target_field_names]
      for input_field_name in input_field_names:
          src_vocab = Vocabulary()
          src_vocab.from_dataset(
              *[
                  ds
                  for name, ds in data_bundle.iter_datasets()
                  if "train" in name
              ],
              field_name=input_field_name,
              no_create_entry_dataset=[
                  ds
                  for name, ds in data_bundle.iter_datasets()
                  if ("train" not in name)
                  and (ds.has_field(input_field_name))
              ],
          )
          src_vocab.index_dataset(
              *data_bundle.datasets.values(),
              field_name=input_field_name,
          )
          data_bundle.set_vocab(src_vocab, input_field_name)
  
      for target_field_name in target_field_names:
          tgt_vocab = Vocabulary(unknown=None, padding=None)
          tgt_vocab.from_dataset(
              *[
                  ds
                  for name, ds in data_bundle.iter_datasets()
                  if "train" in name
              ],
              field_name=target_field_name,
              no_create_entry_dataset=[
                  ds
                  for name, ds in data_bundle.iter_datasets()
                  if ("train" not in name)
                  and (ds.has_field(target_field_name))
              ],
          )
          if len(tgt_vocab._no_create_word) > 0:
              warn_msg = (
                  f"There are {len(tgt_vocab._no_create_word)} `{target_field_name}` labels"
                  f" in {[name for name in data_bundle.datasets.keys() if 'train' not in name]} "
                  f"data set but not in train data set!.\n"
                  f"These label(s) are {tgt_vocab._no_create_word}"
              )
              logger.warning(warn_msg)
              # log.warning(warn_msg)
          tgt_vocab.index_dataset(
              *[
                  ds
                  for ds in data_bundle.datasets.values()
                  if ds.has_field(target_field_name)
              ],
              field_name=target_field_name,
          )
          data_bundle.set_vocab(tgt_vocab, target_field_name)
  
      return data_bundle
  
file_path: fastNLP/fastNLP/io/pipe/utils.py
imports: from typing import List
  from ...core.vocabulary import Vocabulary
  from fastNLP.core.log import logger
  from pkg_resources import parse_version
label_desc: Use image node_id 6 for calling a global function with example usage: _indexize(data_bundle, input_field_names, target_field_names) and returns: data_bundle