code: def test_auto_encoding_type_infer(self):
      #  检查是否可以自动check encode的类型
      vocabs = {}
      import random
  
      for encoding_type in ["bio", "bioes", "bmeso"]:
          vocab = Vocabulary(unknown=None, padding=None)
          for i in range(random.randint(10, 100)):
              label = str(random.randint(1, 10))
              for tag in encoding_type:
                  if tag != "o":
                      vocab.add_word(f"{tag}-{label}")
                  else:
                      vocab.add_word("o")
          vocabs[encoding_type] = vocab
      for e in ["bio", "bioes", "bmeso"]:
          metric = SpanFPreRecMetric(tag_vocab=vocabs[e])
          assert metric.encoding_type == e
  
      bmes_vocab = _generate_tags("bmes")
      vocab = Vocabulary()
      for tag, index in bmes_vocab.items():
          vocab.add_word(tag)
      metric = SpanFPreRecMetric(tag_vocab=vocab)
      assert metric.encoding_type == "bmes"
  
      # 一些无法check的情况
      vocab = Vocabulary()
      for i in range(10):
          vocab.add_word(str(i))
      with pytest.raises(Exception):
          metric = SpanFPreRecMetric(vocab)
  
imports: import pytest
  from collections import Counter
  import os, sys
  import copy
  from functools import partial
  import numpy
  import socket
  from fastNLP.core.vocabulary import Vocabulary
  from fastNLP.core.metrics import SpanFPreRecMetric
  from fastNLP.core.dataset import DataSet
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
  from .utils import find_free_network_port, setup_ddp
label_desc: Use image node_id 5 for calling the TestSpanFPreRecMetric obj's underlying member method code with example usage: obj.test_auto_encoding_type_infer() without return types