def entities_from_tags(self, tokens: List[str], tags: List[str],
                                 tag_probas: List[List[float]]) -> Tuple[dict, dict, dict]:
        """
        This method makes lists of substrings corresponding to entities and entity types
        and a list of indices of tokens which correspond to entities
        Args:
            tokens: list of tokens of the text
            tags: list of tags for tokens
            tag_probas: list of probabilities of tags
        Returns:
            list of entity substrings (or a dict of tags (keys) and entity substrings (values))
            list of substrings for entity types
            list of indices of tokens which correspond to entities (or a dict of tags (keys)
                and list of indices of entity tokens)
        """
        self.ent_dict = defaultdict(list)
        self.ent_pos_dict = defaultdict(list)
        self.ent_probas_dict = defaultdict(list)
        self.ents_pos_probas_dict = defaultdict(list)
        cnt = 0
        for n, (tok, tag, probas) in enumerate(zip(tokens, tags, tag_probas)):
            if tag.split('-')[-1] in self.entity_tags:
                f_tag = tag.split("-")[-1]
                if tag.startswith("B-") and any(self.ent_dict.values()):
                    for c_tag, entity in self.ent_dict.items():
                        self.add_entity(entity, c_tag)
                self.ent_dict[f_tag].append(tok)
                self.ent_pos_dict[f_tag].append(cnt)
                self.ent_probas_dict[f_tag].append(probas[self.tags_ind[tag]])

            elif any(self.ent_dict.values()):
                for tag, entity in self.ent_dict.items():
                    c_tag = tag.split("-")[-1]
                    self.add_entity(entity, c_tag)
            cnt += 1
        if any(self.ent_dict.values()):
            for tag, entity in self.ent_dict.items():
                c_tag = tag.split("-")[-1]
                self.add_entity(entity, c_tag)

        self.ents_pos_probas_dict = {tag: elements for tag, elements in self.ents_pos_probas_dict.items()
                                     if tag not in self.ignored_tags}

        for tag in self.ents_pos_probas_dict:
            ents_pos_proba = self.ents_pos_probas_dict[tag]

        entities_dict = {tag: [ent[0] for ent in ents] for tag, ents in self.ents_pos_probas_dict.items()}
        entities_positions_dict = {tag: [ent[1] for ent in ents] for tag, ents in self.ents_pos_probas_dict.items()}
        entities_probas_dict = {tag: [ent[2] for ent in ents] for tag, ents in self.ents_pos_probas_dict.items()}
        log.debug(f"entities_dict {entities_dict}")

        return entities_dict, entities_positions_dict, entities_probas_dict

        This method makes lists of substrings corresponding to entities and entity types
        and a list of indices of tokens which correspond to entities
        Args:
            tokens: list of tokens of the text
            tags: list of tags for tokens
            tag_probas: list of probabilities of tags
        Returns:
            list of entity substrings (or a dict of tags (keys) and entity substrings (values))
            list of substrings for entity types
            list of indices of tokens which correspond to entities (or a dict of tags (keys)
                and list of indices of entity tokens)
        
deeppavlov/models/entity_extraction/entity_detection_parser.py