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 calc_substr_score(
      self,
      entity_title,
      entity_substr_split,
      tag,
      ent_tag,
      entity_label,
  ):
      if self.lang == "@ru":
          entity_title = entity_title.replace("ё", "е")
      label_tokens = entity_title.split()
      substr_score = self.match_tokens(
          entity_substr_split, label_tokens
      )
      substr_score = self.correct_substr_score(
          entity_substr_split, label_tokens, substr_score
      )
      if re.findall(r" \(.*\)", entity_label):
          entity_label_split = (
              entity_label.replace("(", "")
              .replace(")", "")
              .lower()
              .split()
          )
          lbl_substr_score = self.match_tokens(
              entity_substr_split, entity_label_split
          )
          substr_score = max(substr_score, lbl_substr_score)
      if (
          tag == ent_tag
          and tag.lower() == "person"
          and len(entity_substr_split) > 1
          and len(entity_substr_split[-1]) > 1
          and len(entity_substr_split[-2]) == 1
          and len(label_tokens) == len(entity_substr_split)
      ):
          cnt = 0.0
          for j in range(len(label_tokens) - 1):
              if label_tokens[j][0] == entity_substr_split[j][0]:
                  cnt += 1.0
          if label_tokens[-1] == entity_substr_split[-1]:
              cnt += 1.0
          new_substr_score = cnt / len(label_tokens)
          substr_score = max(substr_score, new_substr_score)
  
      if (
          entity_title.lower() == entity_label.lower()
          and substr_score == 1.0
      ):
          substr_score = substr_score * self.alias_coef
      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 15 for calling the EntityLinker obj's underlying member method code with example usage: obj.calc_substr_score(entity_title, entity_substr_split, tag, ent_tag, entity_label) and returns: substr_score