class_docstr: This class parses probabilities of tokens to be a token from the entity substring.
code: def correct_tags(
      self, tokens: List[str], tags: List[str]
  ) -> List[str]:
      for i in range(len(tags) - 2):
          if len(tags[i]) > 1 and tags[i].startswith("B-"):
              tag = tags[i].split("-")[1]
              if (
                  tags[i + 2] == f"I-{tag}"
                  and tags[i + 1] != f"I-{tag}"
              ):
                  tags[i + 1] = f"I-{tag}"
          if tokens[i + 1] in "«" and tags[i] != "O":
              tags[i] = "O"
              tags[i + 1] = "O"
          if len(tags[i]) > 1 and tags[i].split("-")[1] == "EVENT":
              found_n = -1
              for j in range(i + 1, i + 3):
                  if re.findall(r"[\d]{3,4}", tokens[j]):
                      found_n = j
                      break
              if found_n > 0:
                  for j in range(i + 1, found_n + 1):
                      tags[j] = "I-EVENT"
          if (
              i < len(tokens) - 3
              and len(tokens[i]) == 1
              and tokens[i + 1] == "."
              and len(tokens[i + 2]) == 1
              and tokens[i + 3] == "."
              and tags[i + 2].startswith("B-")
          ):
              tag = tags[i + 2].split("-")[1]
              tags[i] = f"B-{tag}"
              tags[i + 1] = f"I-{tag}"
              tags[i + 2] = f"I-{tag}"
      return tags
  
imports: import re
  from collections import defaultdict
  from logging import getLogger
  from string import punctuation
  from typing import List, Tuple, Union, Any
  import numpy
  from nltk.corpus import stopwords
  from deeppavlov.core.commands.utils import expand_path
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.models.component import Component
label_desc: Use image node_id 4 for calling the EntityDetectionParser obj's underlying member method code with example usage: obj.correct_tags(tokens, tags) and returns: tags