code: def parse_result(lines, crf_decode, id2label_dict, interventer=None):
      """Convert model's output tensor into string and tags"""
      offset_list = crf_decode.lod()[0]
      crf_decode = crf_decode.copy_to_cpu()
      batch_size = len(offset_list) - 1
      batch_out = []
      for sent_index in range(batch_size):
          begin, end = (
              offset_list[sent_index],
              offset_list[sent_index + 1],
          )
          sent = lines[sent_index]
          tags = [
              id2label_dict[str(tag_id[0])]
              for tag_id in crf_decode[begin:end]
          ]
  
          if interventer:
              interventer.parse_customization(sent, tags)
  
          sent_out = []
          tags_out = []
          for ind, tag in enumerate(tags):
              # for the first char
              if (
                  len(sent_out) == 0
                  or tag.endswith("B")
                  or tag.endswith("S")
              ):
                  sent_out.append(sent[ind])
                  tags_out.append(tag[:-2])
                  continue
              sent_out[-1] += sent[ind]
              tags_out[-1] = tag[:-2]
  
          seg_result = {"word": sent_out, "tag": tags_out}
          batch_out.append(seg_result)
  
      return batch_out
  
imports: import io
  import numpy
  import six
label_desc: Use image node_id 3 for calling a global function with example usage: parse_result(lines, crf_decode, id2label_dict, interventer) and returns: batch_out