class_docstr: This class extract relations, objects or triplets from Wikidata HDT file.
class_docstr_tok: ["This","class","extract","relations",",","objects","or","triplets","from","Wikidata","HDT","file","."]
code: def find_types(self, entity: str):
      types = []
      if self.file_format == "hdt":
          if not entity.startswith("http"):
              entity = f"{self.prefixes['entity']}/{entity}"
          tr, c = self.document.search_triples(
              entity, f"{self.prefixes['rels']['direct']}/P31", ""
          )
          types = [triplet[2].split("/")[-1] for triplet in tr]
          for rel in ["P106", "P21"]:
              tr, c = self.document.search_triples(
                  entity, f"{self.prefixes['rels']['direct']}/{rel}", ""
              )
              types += [triplet[2].split("/")[-1] for triplet in tr]
  
      if self.file_format == "pickle":
          entity = entity.split("/")[-1]
          triplets = self.document.get(entity, {}).get("forw", [])
          triplets = self.uncompress(triplets)
          for triplet in triplets:
              if triplet[0] == "P31":
                  types = triplet[1:]
      types = set(types)
      return types
  
imports: import datetime
  import re
  from collections import namedtuple
  from logging import getLogger
  from typing import List, Tuple, Dict, Any, Union
  from hdt import HDTDocument
  from deeppavlov.core.commands.utils import expand_path
  from deeppavlov.core.common.file import load_pickle, read_json
  from deeppavlov.core.common.registry import register
label_desc: Use image node_id 15 for calling the WikiParser obj's underlying member method code with example usage: obj.find_types(entity) and returns: types