class_docstr: Coref Sample
class_docstr_tok: ["Coref","Sample"]
docstr: Replace scope items of field value with items.
  :param str field: transformed field
  :param list indices: indices of delete positions
  :param list items: insert items
  :return ~textflint.CorefSample: modified sample
docstr_tok: ["Replace","scope","items","of","field","value","with","items",".",":","param","str","field",":","transformed","field",":","param","list","indices",":","indices","of","delete","positions",":","param","list","items",":","insert","items",":","return","~textflint.CorefSample",":","modified","sample"]
code: def replace_field_at_indices(self, field, indices, items):
      r"""
  
      Replace scope items of field value with items.
      :param str field: transformed field
      :param list indices: indices of delete positions
      :param list items: insert items
      :return ~textflint.CorefSample: modified sample
  
      """
      # arg type check
      assert field == "x"
      for span, item in zip(indices, items):
          if isinstance(span, int):
              len_span = 1
          elif isinstance(span, list):
              assert len(span) == 2
              len_span = span[1] - span[0]
          elif isinstance(span, slice):
              assert span.start >= 0
              assert span.stop >= span.start
              assert span.step == 1 or span.step == None
              len_span = span.stop - span.start
          else:
              raise AssertionError
  
          if isinstance(item, str):
              len_item = 1
          elif isinstance(item, list):
              if len(item) > 0:
                  assert isinstance(item[0], str)
              len_item = len(item)
          else:
              raise AssertionError
          assert len_span == len_item
  
      # start
      sample = self.clone(self)
      # x
      field_obj = getattr(sample, "x")
      assert isinstance(field_obj, TextField)
      rep_obj = field_obj.replace_at_indices(indices, items)
      setattr(sample, "x", rep_obj)
  
      # doc_sp
      items_sp = recur_ap(lambda x: "sp_repl", items)
      field_obj = getattr(sample, "doc_sp")
      assert isinstance(field_obj, TextField)
      rep_obj = field_obj.replace_at_indices(indices, items_sp)
      setattr(sample, "doc_sp", rep_obj)
  
      return CorefPartSample(
          sample.dump(with_check=False)
      ).remove_invalid_corefs_from_part()
  
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 17 for calling the CorefSample obj's underlying member method code with example usage: obj.replace_field_at_indices(field, indices, items) and returns: CorefPartSample