class_docstr: Class for linking of entity substrings in the document to entities in Wikidata
class_docstr_tok: ["Class","for","linking","of","entity","substrings","in","the","document","to","entities","in","Wikidata"]
code: def correct_substr_score(
      self, entity_substr_split, label_tokens, substr_score
  ):
      if (
          sum([len(tok) == 1 for tok in entity_substr_split]) == 2
          and len(label_tokens) >= 2
          and any(
              [
                  (len(tok) == 2 and re.findall(r"[a-z]{2}", tok))
                  for tok in label_tokens
              ]
          )
      ):
          new_label_tokens = []
          for tok in label_tokens:
              if len(tok) == 2 and re.findall(r"[a-z]{2}", tok):
                  new_label_tokens.append(tok[0])
                  new_label_tokens.append(tok[1])
              else:
                  new_label_tokens.append(tok)
          label_tokens = new_label_tokens
      if any(
          [re.findall(r"[\d]{4}", tok) for tok in entity_substr_split]
      ) and any(
          [re.findall(r"[\d]{4}–[\d]{2}", tok) for tok in label_tokens]
      ):
          new_label_tokens = []
          for tok in label_tokens:
              if re.findall(r"[\d]{4}–[\d]{2}", tok):
                  new_label_tokens.append(tok[:4])
                  new_label_tokens.append(tok[5:])
              else:
                  new_label_tokens.append(tok)
          label_tokens = new_label_tokens
      new_substr_score = self.match_tokens(
          entity_substr_split, label_tokens
      )
      substr_score = max(substr_score, new_substr_score)
      return substr_score
  
imports: import re
  import sqlite3
  from logging import getLogger
  from typing import List, Dict, Tuple, Any, Union
  from collections import defaultdict
  import nltk
  import spacy
  from hdt import HDTDocument
  from nltk.corpus import stopwords
  from rapidfuzz import fuzz
  from deeppavlov.core.commands.utils import expand_path
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.models.component import Component
  from deeppavlov.core.models.serializable import Serializable
  from deeppavlov.models.entity_extraction.find_word import WordSearcher
label_desc: Use image node_id 14 for calling the EntityLinker obj's underlying member method code with example usage: obj.correct_substr_score(entity_substr_split, label_tokens, substr_score) and returns: substr_score