class_docstr: Model wrapper for Named Entity Recognition
class_docstr_tok: ["Model","wrapper","for","Named","Entity","Recognition"]
code: def extract_gold_res_from_gold_annotation(
      self, tensor_example, stored_info=None
  ):
      output_ids = tensor_example["target_ids"]
      mapping = self.get_mapping_to_input_sequence(output_ids)
  
      ent_types, ent_indices = (
          tensor_example["ent_types"],
          tensor_example["ent_indices"],
      )
      subtoken_map = stored_info["subtoken_map"]
      entities, start_ind = [], []
  
      # reconstructing mention_indices and antecedent_indices
      for i in range(len(output_ids)):
          if output_ids[i] == self.mention_start_id:
              start_ind.append(i)
          if output_ids[i] == self.mention_end_id:
              entity = (
                  int(
                      subtoken_map[int(mapping[start_ind[-1]])]
                  ),  # no nested
                  int(subtoken_map[int(mapping[i])]),
                  int(ent_types[i]),
              )
              entities.append(entity)
  
      result_dict = {"gold_entities": entities, "gold_relations": []}
      return result_dict
  
file_path: DeepKE/src/deepke/triple_extraction/ASP/models/model_ner.py
imports: import sys
  import os
  import torch
  import torch.nn
  import logging
  from transformers import T5Tokenizer
  from .t5_ner import T5NER
label_desc: Use image node_id 6 for calling the NERModel obj's underlying member method code with example usage: obj.extract_gold_res_from_gold_annotation(tensor_example, stored_info) and returns: result_dict