class_docstr: This class parses probabilities of tokens to be a token from the entity substring.
docstr: Args:
      o_tag: tag for tokens which are neither entities nor types
      tags_file: filename with NER tags
      entity_tags: tags for entities
      ignore_points: whether to consider points as separate symbols
      thres_proba: if the probability of the tag is less than thres_proba, we assign the tag as 'O'
      make_tags_from_probas: whether to define token tags from confidences from sequence tagging model
      lang: language of texts
      ignored_tags: not used tags of entities
docstr_tok: ["Args",":","o_tag",":","tag","for","tokens","which","are","neither","entities","nor","types","tags_file",":","filename","with","NER","tags","entity_tags",":","tags","for","entities","ignore_points",":","whether","to","consider","points","as","separate","symbols","thres_proba",":","if","the","probability","of","the","tag","is","less","than","thres_proba",",","we","assign","the","tag","as","'","O'","make_tags_from_probas",":","whether","to","define","token","tags","from","confidences","from","sequence","tagging","model","lang",":","language","of","texts","ignored_tags",":","not","used","tags","of","entities"]
code: def __init__(
      self,
      o_tag: str,
      tags_file: str,
      entity_tags: List[str] = None,
      ignore_points: bool = False,
      thres_proba: float = 0.8,
      make_tags_from_probas: bool = False,
      lang: str = "en",
      ignored_tags: List[str] = None,
      **kwargs,
  ):
      """
      Args:
          o_tag: tag for tokens which are neither entities nor types
          tags_file: filename with NER tags
          entity_tags: tags for entities
          ignore_points: whether to consider points as separate symbols
          thres_proba: if the probability of the tag is less than thres_proba, we assign the tag as 'O'
          make_tags_from_probas: whether to define token tags from confidences from sequence tagging model
          lang: language of texts
          ignored_tags: not used tags of entities
      """
      self.entity_tags = entity_tags
      self.o_tag = o_tag
      self.ignore_points = ignore_points
      self.thres_proba = thres_proba
      self.tag_ind_dict = {}
      with open(str(expand_path(tags_file))) as fl:
          tags = [line.split("\t")[0] for line in fl.readlines()]
          self.tags = tags
          if self.entity_tags is None:
              self.entity_tags = list(
                  {
                      tag.split("-")[1]
                      for tag in tags
                      if len(tag.split("-")) > 1
                  }.difference({self.o_tag})
              )
  
          self.entity_prob_ind = {
              entity_tag: [
                  i for i, tag in enumerate(tags) if entity_tag in tag
              ]
              for entity_tag in self.entity_tags
          }
          self.tags_ind = {tag: i for i, tag in enumerate(tags)}
          self.et_prob_ind = [
              i
              for tag, ind in self.entity_prob_ind.items()
              for i in ind
          ]
          for entity_tag, tag_ind in self.entity_prob_ind.items():
              for ind in tag_ind:
                  self.tag_ind_dict[ind] = entity_tag
          self.tag_ind_dict[0] = self.o_tag
      self.make_tags_from_probas = make_tags_from_probas
      if lang == "en":
          self.stopwords = set(stopwords.words("english"))
      elif lang == "ru":
          self.stopwords = set(stopwords.words("russian"))
      else:
          raise ValueError(
              f'Unsupported lang value: "{lang}". Only "en" and "ru" are allowed.'
          )
      self.ignored_tags = ignored_tags or []
  
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 1 to create a new EntityDetectionParser object from inherited base classes: Component with example: obj = EntityDetectionParser(o_tag, tags_file, entity_tags, ignore_points, thres_proba, make_tags_from_probas, lang, ignored_tags)