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","."]
docstr: Args:
      wiki_filename: file with Wikidata
      file_format: format of Wikidata file
      lang: Russian or English language
      **kwargs:
docstr_tok: ["Args",":","wiki_filename",":","file","with","Wikidata","file_format",":","format","of","Wikidata","file","lang",":","Russian","or","English","language","*","*","kwargs",":"]
code: def __init__(
      self,
      wiki_filename: str,
      file_format: str = "hdt",
      prefixes: Dict[str, Union[str, Dict[str, str]]] = None,
      rel_q2name_filename: str = None,
      max_comb_num: int = 1e6,
      lang: str = "@en",
      **kwargs,
  ) -> None:
      """
  
      Args:
          wiki_filename: file with Wikidata
          file_format: format of Wikidata file
          lang: Russian or English language
          **kwargs:
      """
  
      if prefixes is None:
          prefixes = {
              "entity": "http://we",
              "label": "http://wl",
              "alias": "http://wal",
              "description": "http://wd",
              "rels": {
                  "direct": "http://wpd",
                  "no_type": "http://wp",
                  "statement": "http://wps",
                  "qualifier": "http://wpq",
                  "type": "http://wpd/P31",
              },
              "statement": "http://ws",
          }
      self.prefixes = prefixes
      self.file_format = file_format
      self.wiki_filename = str(expand_path(wiki_filename))
      if self.file_format == "hdt":
          self.document = HDTDocument(self.wiki_filename)
      elif self.file_format == "pickle":
          self.document = load_pickle(self.wiki_filename)
          self.parsed_document = {}
      else:
          raise ValueError("Unsupported file format")
      self.used_rels = set()
      self.rel_q2name = dict()
      if rel_q2name_filename:
          if rel_q2name_filename.endswith("json"):
              self.rel_q2name = read_json(
                  str(expand_path(rel_q2name_filename))
              )
          elif rel_q2name_filename.endswith("pickle"):
              self.rel_q2name = load_pickle(
                  str(expand_path(rel_q2name_filename))
              )
          else:
              raise ValueError(
                  f"Unsupported file format: {rel_q2name_filename}"
              )
  
      self.max_comb_num = max_comb_num
      self.lang = lang
      self.replace_tokens = [
          ('"', ""),
          (self.lang, " "),
          ("$", " "),
          ("  ", " "),
      ]
  
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 1 to create a new WikiParser object  with example: obj = WikiParser(wiki_filename, file_format, prefixes, rel_q2name_filename, max_comb_num, lang)