class_docstr: This class matches the question with one of the templates
  to extract entity substrings and define which relations
  corresponds to the question
class_docstr_tok: ["This","class","matches","the","question","with","one","of","the","templates","to","extract","entity","substrings","and","define","which","relations","corresponds","to","the","question"]
code: def match_template_and_ner(
      self,
      entities_cand: List[str],
      entities_from_ner: List[str],
      template: str,
  ):
      entities_from_ner = [
          entity.lower() for entity in entities_from_ner
      ]
      entities_from_ner = [
          re.sub(r"^(a |the )", "", entity)
          for entity in entities_from_ner
      ]
      entities_cand = [
          re.sub(r"^(a |the )", "", entity) for entity in entities_cand
      ]
      entities_cand = [entity.strip() for entity in entities_cand]
      log.debug(
          f"entities_cand {entities_cand} entities_from_ner {entities_from_ner}"
      )
      match = (
          set(entities_cand) == set(entities_from_ner)
          or not entities_from_ner
          or template == "how to xxx?"
      )
      return match, entities_cand
  
file_path: DeepPavlov/deeppavlov/models/kbqa/template_matcher.py
imports: import functools
  import json
  import multiprocessing
  import re
  from logging import getLogger
  from typing import Any, Tuple, List, Union
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.models.serializable import Serializable
label_desc: Use image node_id 6 for calling the TemplateMatcher obj's underlying member method code with example usage: obj.match_template_and_ner(entities_cand, entities_from_ner, template) and returns: match,  entities_cand