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 format_date(self, entity, question):
      dates_dict = {
          "January": "января",
          "February": "февраля",
          "March": "марта",
          "April": "апреля",
          "May": "мая",
          "June": "июня",
          "July": "июля",
          "August": "августа",
          "September": "сентября",
          "October": "октября",
          "November": "ноября",
          "December": "декабря",
      }
      date_info = re.findall(
          "([\d]{3,4})-([\d]{1,2})-([\d]{1,2})", entity
      )
      if date_info:
          year, month, day = date_info[0]
          if (
              "how old" in question.lower()
              or "сколько лет" in question.lower()
          ):
              entity = datetime.datetime.now().year - int(year)
          elif "в каком году" in question.lower():
              entity = year
          elif "в каком месяце" in question.lower():
              entity = month
          elif day not in {"00", "0"}:
              date = datetime.datetime.strptime(
                  f"{year}-{month}-{day}", "%Y-%m-%d"
              )
              entity = date.strftime("%d %B %Y")
          else:
              entity = year
          if self.lang == "@ru":
              for mnth, mnth_replace in dates_dict.items():
                  entity = entity.replace(mnth, mnth_replace)
          return str(entity)
      entity = entity.lstrip("+-")
      return entity
  
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 9 for calling the WikiParser obj's underlying member method code with example usage: obj.format_date(entity, question) and returns: entity, str