class_docstr: Coref Sample
class_docstr_tok: ["Coref","Sample"]
docstr: Insert items of given scopes before indices of field value simutaneously
  
  :param str field: transformed field
  :param list indices: indices of insert positions
  :param list items: insert items
  :return ~textflint.CorefSample: modified sample
docstr_tok: ["Insert","items","of","given","scopes","before","indices","of","field","value","simutaneously",":","param","str","field",":","transformed","field",":","param","list","indices",":","indices","of","insert","positions",":","param","list","items",":","insert","items",":","return","~textflint.CorefSample",":","modified","sample"]
code: def insert_field_before_indices(self, field, indices, items):
      r"""
      Insert items of given scopes before indices of field value simutaneously
  
      :param str field: transformed field
      :param list indices: indices of insert positions
      :param list items: insert items
      :return ~textflint.CorefSample: modified sample
  
      """
      # arg type check
      assert field == "x"
      for idx, item in zip(indices, items):
          assert isinstance(idx, int)
          assert isinstance(item, (str, list))
          if isinstance(item, list) and len(item) > 0:
              assert isinstance(item[0], str)
      # start
      sample = self.clone(self)
      # x
      field_obj = getattr(sample, "x")
      assert isinstance(field_obj, TextField)
      rep_obj = field_obj.insert_before_indices(indices, items)
      setattr(sample, "x", rep_obj)
  
      # doc_sp
      items_sp = recur_ap(lambda x: "sp_ins", items)
      field_obj = getattr(sample, "doc_sp")
      assert isinstance(field_obj, TextField)
      rep_obj = field_obj.insert_before_indices(indices, items_sp)
      setattr(sample, "doc_sp", rep_obj)
      # calc for item lengths (item_shifts)
      item_shifts = [
          1 if isinstance(item, str) else len(item) for item in items
      ]
  
      # calc for shift
      shifts = [
          shift_maker(idx, item_shift)
          for (idx, item_shift) in zip(indices, item_shifts)
      ]
      index_shift = shift_decor(shift_collector(shifts))
  
      # clusters, constituents, ner
      clusters = getattr(sample, "clusters").field_value
      constituents = getattr(sample, "constituents").field_value
      ner = getattr(sample, "ner").field_value
      setattr(
          sample, "clusters", ListField(recur_ap(index_shift, clusters))
      )
      setattr(
          sample,
          "constituents",
          ListField(recur_ap(index_shift, constituents)),
      )
      setattr(sample, "ner", ListField(recur_ap(index_shift, ner)))
  
      # sen_map
      sen_map = getattr(sample, "sen_map")
      for idx, item_shift in zip(indices, item_shifts):
          sen_idx = self.index_in_sen(idx)
          sen_map[sen_idx] += item_shift
      setattr(sample, "sen_map", sen_map)
  
      return sample
  
imports: from ....common.settings import ORIGIN, TASK_MASK
  from ....common.utils.fp_utils import *
  from ....common.utils.shift_utils import *
  from .sample import Sample
  from ..field import ListField, TextField
label_desc: Use image node_id 14 for calling the CorefSample obj's underlying member method code with example usage: obj.insert_field_before_indices(field, indices, items) and returns: sample