code: def _check_tag_vocab_and_encoding_type(
      tag_vocab: Union[Vocabulary, dict], encoding_type: str
  ):
      r"""
      检查vocab中的tag是否与encoding_type是匹配的
  
      :param tag_vocab: 支持传入tag Vocabulary; 或者传入形如{0:"O", 1:"B-tag1"}，即index在前，tag在后的dict。
      :param encoding_type: bio, bmes, bioes, bmeso
      :return:
      """
      tag_set = set()
      unk_token = "<unk>"
      pad_token = "<pad>"
      if isinstance(tag_vocab, Vocabulary):
          unk_token = tag_vocab.unknown
          pad_token = tag_vocab.padding
          tag_vocab = tag_vocab.idx2word
      for idx, tag in tag_vocab.items():
          if tag in (unk_token, pad_token):
              continue
          tag = tag[:1].lower()
          tag_set.add(tag)
  
      tags = encoding_type
      for tag in tag_set:
          assert tag in tags, (
              f"{tag} is not a valid tag in encoding type:{encoding_type}. Please check your "
              f"encoding_type."
          )
          tags = tags.replace(tag, "")  # 删除该值
      if tags:  # 如果不为空，说明出现了未使用的tag
          logger.warning(
              f"Tag:{tags} in encoding type:{encoding_type} is not presented in your Vocabulary. Check your "
              "encoding_type."
          )
  
file_path: fastNLP/fastNLP/core/metrics/span_f1_pre_rec_metric.py
imports: from typing import Union, List, Optional
  from collections import Counter
  from fastNLP.core.metrics.backend import Backend
  from fastNLP.core.metrics.metric import Metric
  from fastNLP.core.vocabulary import Vocabulary
  from fastNLP.core.log import logger
  from .utils import _compute_f_pre_rec
label_desc: Use image node_id 1 for calling a global function with example usage: _check_tag_vocab_and_encoding_type(tag_vocab, encoding_type) without return types