docstr: :param gold_list:
  :param pred_list:
  :param text_list:
  :param raw_list:
  :return:
      dict:
          pred_spot -> [(type1, text1), (type2, text2), ...]
          gold_spot -> [(type1, text1), (type2, text2), ...]
          pred_asoc -> [(spot type1, asoc type1, text1), (spot type2, asoc type2, text2), ...]
          gold_asoc -> [(spot type1, asoc type1, text1), (spot type2, asoc type2, text2), ...]
          pred_record -> [{'type': type1, 'text': text1, 'roles': [(spot type1, asoc type1, text1), ...]},
                          {'type': type2, 'text': text2, 'roles': [(spot type2, asoc type2, text2), ...]},
                          ]
          gold_record -> [{'type': type1, 'text': text1, 'roles': [(spot type1, asoc type1, text1), ...]},
                          {'type': type2, 'text': text2, 'roles': [(spot type2, asoc type2, text2), ...]},
                          ]
      Counter:
docstr_tok: [":","param","gold_list",":",":","param","pred_list",":",":","param","text_list",":",":","param","raw_list",":",":","return",":","dict",":","pred_spot","-",">","[","(","type1",",","text1",")",",","(","type2",",","text2",")",",","...","]","gold_spot","-",">","[","(","type1",",","text1",")",",","(","type2",",","text2",")",",","...","]","pred_asoc","-",">","[","(","spot","type1",",","asoc","type1",",","text1",")",",","(","spot","type2",",","asoc","type2",",","text2",")",",","...","]","gold_asoc","-",">","[","(","spot","type1",",","asoc","type1",",","text1",")",",","(","spot","type2",",","asoc","type2",",","text2",")",",","...","]","pred_record","-",">","[","{","'type","'",":","type1",",","'text","'",":","text1",",","'roles","'",":","[","(","spot","type1",",","asoc","type1",",","text1",")",",","...","]","}",",","{","'type","'",":","type2",",","'text","'",":","text2",",","'roles","'",":","[","(","spot","type2",",","asoc","type2",",","text2",")",",","...","]","}",",","]","gold_record","-",">","[","{","'type","'",":","type1",",","'text","'",":","text1",",","'roles","'",":","[","(","spot","type1",",","asoc","type1",",","text1",")",",","...","]","}",",","{","'type","'",":","type2",",","'text","'",":","text2",",","'roles","'",":","[","(","spot","type2",",","asoc","type2",",","text2",")",",","...","]","}",",","]","Counter",":"]
code: def decode(
      self, gold_list, pred_list, text_list=None, raw_list=None
  ) -> Tuple[List[Dict], Counter]:
      """
  
      :param gold_list:
      :param pred_list:
      :param text_list:
      :param raw_list:
      :return:
          dict:
              pred_spot -> [(type1, text1), (type2, text2), ...]
              gold_spot -> [(type1, text1), (type2, text2), ...]
              pred_asoc -> [(spot type1, asoc type1, text1), (spot type2, asoc type2, text2), ...]
              gold_asoc -> [(spot type1, asoc type1, text1), (spot type2, asoc type2, text2), ...]
              pred_record -> [{'type': type1, 'text': text1, 'roles': [(spot type1, asoc type1, text1), ...]},
                              {'type': type2, 'text': text2, 'roles': [(spot type2, asoc type2, text2), ...]},
                              ]
              gold_record -> [{'type': type1, 'text': text1, 'roles': [(spot type1, asoc type1, text1), ...]},
                              {'type': type2, 'text': text2, 'roles': [(spot type2, asoc type2, text2), ...]},
                              ]
          Counter:
      """
      counter = Counter()
      well_formed_list = []
  
      if gold_list is None or len(gold_list) == 0:
          gold_list = ["%s%s" % (type_start, type_end)] * len(pred_list)
  
      if text_list is None:
          text_list = [None] * len(pred_list)
  
      if raw_list is None:
          raw_list = [None] * len(pred_list)
  
      for gold, pred, text, raw_data in zip(
          gold_list, pred_list, text_list, raw_list
      ):
          gold = convert_bracket(gold)
          pred = convert_bracket(pred)
  
          pred = clean_text(pred)
  
          try:
              gold_tree = ParentedTree.fromstring(
                  gold, brackets=brackets
              )
          except ValueError:
              logger.warning(f"Ill gold: {gold}")
              logger.warning(f"Fix gold: {add_bracket(gold)}")
              gold_tree = ParentedTree.fromstring(
                  add_bracket(gold), brackets=brackets
              )
              counter.update(["gold_tree add_bracket"])
  
          instance = {
              "gold": gold,
              "pred": pred,
              "gold_tree": gold_tree,
              "text": text,
              "raw_data": raw_data,
          }
  
          counter.update(["gold_tree" for _ in gold_tree])
  
          (
              instance["gold_spot"],
              instance["gold_asoc"],
              instance["gold_record"],
          ) = self.get_record_list(
              sel_tree=instance["gold_tree"], text=instance["text"]
          )
  
          try:
              if not check_well_form(pred):
                  pred = add_bracket(pred)
                  counter.update(["fixed"])
  
              pred_tree = ParentedTree.fromstring(
                  pred, brackets=brackets
              )
              counter.update(["pred_tree" for _ in pred_tree])
  
              instance["pred_tree"] = pred_tree
              counter.update(["well-formed"])
  
          except ValueError:
              counter.update(["ill-formed"])
              logger.debug("ill-formed", pred)
              instance["pred_tree"] = ParentedTree.fromstring(
                  left_bracket + right_bracket, brackets=brackets
              )
  
          (
              instance["pred_spot"],
              instance["pred_asoc"],
              instance["pred_record"],
          ) = self.get_record_list(
              sel_tree=instance["pred_tree"], text=instance["text"]
          )
  
          well_formed_list += [instance]
  
      return well_formed_list, counter
  
imports: from collections import Counter
  import logging
  from nltk.tree import ParentedTree
  import re
  from typing import Tuple, List, Dict
  from ...extraction.constants import null_span, type_start, type_end, span_start
  from ...extraction.predict_parser.predict_parser import PredictParser
  from ...extraction.predict_parser.utils import fix_unk_from_text
label_desc: Use image node_id 1 for calling the SpotAsocPredictParser obj's underlying member method code with example usage: obj.decode(gold_list, pred_list, text_list, raw_list) and returns: well_formed_list,  counter