class_docstr: DP Sample class to hold the data info and provide atomic operations.
docstr: Delete data at the given position.
  
  :param str field: Only value 'x' supported.
  :param int|list|slice del_index:
      can be int indicate replace single item or their list
          like [1, 2, 3],
      can be list like (0,3) indicate replace items
          from 0 to 3(not included),
      can be slice which would be convert to list.
  :return ~DPSample: The sentence with one word deleted.
docstr_tok: ["Delete","data","at","the","given","position",".",":","param","str","field",":","Only","value","'","x","'","supported",".",":","param","int|list|slice","del_index",":","can","be","int","indicate","replace","single","item","or","their","list","like","[","1",",","2",",","3","]",",","can","be","list","like","(","0,3",")","indicate","replace","items","from","0","to","3","(","not","included",")",",","can","be","slice","which","would","be","convert","to","list",".",":","return","~DPSample",":","The","sentence","with","one","word","deleted","."]
code: def delete_field_at_index(self, field, del_index):
      r"""
      Delete data at the given position.
  
      :param str field: Only value 'x' supported.
      :param int|list|slice del_index:
          can be int indicate replace single item or their list
              like [1, 2, 3],
          can be list like (0,3) indicate replace items
              from 0 to 3(not included),
          can be slice which would be convert to list.
      :return ~DPSample: The sentence with one word deleted.
  
      """
      assert field == "x"
      del_scope = normalize_scope(del_index)
      del_len = del_scope[1] - del_scope[0]
  
      sample = self.clone(self)
      sample = super(DPSample, sample).delete_field_at_indices(
          field, [del_scope]
      )
      sample = super(DPSample, sample).delete_field_at_indices(
          "postag", [del_scope]
      )
      sample = super(DPSample, sample).delete_field_at_indices(
          "head", [del_scope]
      )
  
      sample = super(DPSample, sample).delete_field_at_indices(
          "deprel", [del_scope]
      )
  
      head_obj = sample.get_value("head")
      rep_obj = sample.head
      for i, head in enumerate(head_obj):
          head_id = int(head)
          # keep words dependency pointer which in del_scope may cause error
          # assume won't delete item with dependency pointers
          if head_id >= del_scope[1]:
              rep_obj = rep_obj.replace_at_index(
                  i, str(head_id - del_len)
              )
      setattr(sample, "head", rep_obj)
  
      return sample
  
file_path: textflint/textflint/input/component/sample/dp_sample.py
imports: from .sample import Sample
  from ..field import ListField, TextField
  from ....common.utils.list_op import get_align_seq, normalize_scope
label_desc: Use image node_id 11 for calling the DPSample obj's underlying member method code with example usage: obj.delete_field_at_index(field, del_index) and returns: sample