class_docstr: Record for converting generated string to information record in predicate-arguments
  {
      type: pred_type,
      trigger: predicate_span,
      args: [(arg_type, arg_span), ...]
  }
class_docstr_tok: ["Record","for","converting","generated","string","to","information","record","in","predicate-arguments","{","type",":","pred_type",",","trigger",":","predicate_span",",","args",":","[","(","arg_type",",","arg_span",")",",","...","]","}"]
docstr: Find Role's offset using first matched in the sentence.
docstr_tok: ["Find","Role","'s","offset","using","first","matched","in","the","sentence","."]
code: def record_to_offset_first_role(self, instance, token_list):
      """
      Find Role's offset using first matched in the sentence.
      """
      record_list = list()
  
      trigger_matched_set = set()
      for record in instance:
          event_type = record["type"]
          trigger = record["trigger"]
          matched_list = match_sublist(
              token_list, self.span_to_token(trigger)
          )
  
          if len(matched_list) == 0:
              logger.warning(
                  "[Cannot reconstruct]: %s %s\n"
                  % (trigger, token_list)
              )
              continue
  
          trigger_offset = None
          for matched in matched_list:
              if matched not in trigger_matched_set:
                  trigger_offset = get_index_tuple(matched)
                  trigger_matched_set.add(matched)
                  break
  
          # No trigger word, skip the record
          if trigger_offset is None:
              break
  
          pred_record = {
              "type": event_type,
              "roles": [],
              "trigger": trigger_offset,
          }
  
          for role_type, text_str in record["roles"]:
              matched_list = match_sublist(
                  token_list, self.span_to_token(text_str)
              )
              if len(matched_list) == 0:
                  logger.warning(
                      "[Cannot reconstruct]: %s %s\n"
                      % (text_str, token_list)
                  )
                  continue
              pred_record["roles"] += [
                  (role_type, get_index_tuple(matched_list[0]))
              ]
  
          record_list += [pred_record]
  
      return record_list
  
imports: from asyncio.log import logger
  import sys
  from typing import Tuple
  import numpy
  import logging
label_desc: Use image node_id 3 for calling the EventRecord obj's underlying member method code with example usage: obj.record_to_offset_first_role(instance, token_list) and returns: record_list