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 fill_triplets(self, init_triplets, what_to_return, comb):
      filled_triplets = []
      for n, (subj, rel, obj) in enumerate(init_triplets):
          if (
              "statement" in self.prefixes
              and subj.startswith("?")
              and comb.get(subj, "").startswith(
                  self.prefixes["statement"]
              )
              and not rel.startswith("?")
              and (
                  obj == what_to_return[0]
                  or re.findall(
                      r"[\d]{3,4}", comb.get(what_to_return[0], "")
                  )
              )
          ):
              continue
          else:
              if (
                  "statement" in self.prefixes
                  and subj.startswith("?")
                  and str(comb.get(subj, "")).startswith(
                      self.prefixes["statement"]
                  )
              ):
                  if not comb.get(what_to_return[0], "").startswith(
                      "http"
                  ) and re.findall(
                      r"[\d]{3,4}", comb.get(what_to_return[0], "")
                  ):
                      subj = init_triplets[1][2]
                  else:
                      subj = what_to_return[0]
              if (
                  "statement" in self.prefixes
                  and obj.startswith("?")
                  and str(comb.get(obj, "")).startswith(
                      self.prefixes["statement"]
                  )
              ):
                  if not str(
                      comb.get(what_to_return[0], "")
                  ).startswith("http") and re.findall(
                      r"[\d]{3,4}", str(comb.get(what_to_return[0], ""))
                  ):
                      obj = init_triplets[1][2]
                  else:
                      obj = what_to_return[0]
              subj, obj = str(subj), str(obj)
              if subj.startswith("?"):
                  subj = comb.get(subj, "")
              if obj.startswith("?"):
                  obj = comb.get(obj, "")
              if rel.startswith("?"):
                  rel = comb.get(rel, "")
              subj_label = self.find_label(subj)
              obj_label = self.find_label(obj)
              if rel in self.rel_q2name:
                  rel_label = self.rel_q2name[rel]
              elif rel.split("/")[-1] in self.rel_q2name:
                  rel_label = self.rel_q2name[rel.split("/")[-1]]
              else:
                  rel_label = self.find_label(rel)
              if isinstance(rel_label, list) and rel_label:
                  rel_label = rel_label[0]
              filled_triplets.append([subj_label, rel_label, obj_label])
      return filled_triplets
  
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 20 for calling the WikiParser obj's underlying member method code with example usage: obj.fill_triplets(init_triplets, what_to_return, comb) and returns: filled_triplets