code: def transform(self, y):
      all_labels = []
      for y_i in y:
          # List of dictionaries, where the key is the label and the value is
          # the span being labeled
  
          # TODO: Add sorting of y_i before encoding, as Doc2Dict tends to do
          # bettter when labels and text appear in a consistent order
  
          labels = [{span["label"]: span["text"]} for span in y_i]
          all_labels.append(json.dumps(labels))
      ret = super().transform(all_labels)
      return ret
  
imports: from abc import ABCMeta
  import logging
  import json
  import numpy
  from finetune.encoding.target_encoders import BaseEncoder, Seq2SeqLabelEncoder, SequenceLabelingEncoder
label_desc: Use image node_id 1 for calling the SequenceLabelingTextEncoder obj's underlying member method code with example usage: obj.transform(y) and returns: ret