class_docstr: WSDSample Class
class_docstr_tok: ["WSDSample","Class"]
docstr: Replace scope items of field value with items of same length.
  :param str field: transformed field
  :param list indices: indices of delete positions
  :param list items: insert items
  :param list pos_list: default none, list of pos for items
  :param list lemma_list: default none, list of lemma for items
  :return WSDSample: a modified sample
docstr_tok: ["Replace","scope","items","of","field","value","with","items","of","same","length",".",":","param","str","field",":","transformed","field",":","param","list","indices",":","indices","of","delete","positions",":","param","list","items",":","insert","items",":","param","list","pos_list",":","default","none",",","list","of","pos","for","items",":","param","list","lemma_list",":","default","none",",","list","of","lemma","for","items",":","return","WSDSample",":","a","modified","sample"]
code: def replace_field_at_indices(
      self, field, indices, items, pos_list=None, lemma_list=None
  ):
      r"""
      Replace scope items of field value with items of same length.
      :param str field: transformed field
      :param list indices: indices of delete positions
      :param list items: insert items
      :param list pos_list: default none, list of pos for items
      :param list lemma_list: default none, list of lemma for items
      :return WSDSample: a modified sample
      """
      self.check_indices_and_items(indices, items)
      # special for swap target
      if field == "sensekey":
          sensekeys = items
          items = list()
          for sk in sensekeys:
              items.append([t.split("%")[0] for t in sk])
      sample = self.clone(self)
      # replace word in sentences
      sample = super(WSDSample, sample).replace_field_at_indices(
          "sentence", indices, items
      )
      # replace corresponding pos
      # pos won't change in swap target case
      if field != "sensekey":
          new_pos = sample.tag_words(items)
          sample = super(WSDSample, sample).replace_field_at_indices(
              "pos", indices, new_pos
          )
  
      # replace corresponding lemma
      sample = super(WSDSample, sample).replace_field_at_indices(
          "lemma", indices, items
      )
  
      # check if any target word is replaced
      if field != "sensekey":
          idx_list = self.get_idx_list(indices)
      targets = []  # update instance information
      for key, start, end, word, sense in sample.instance:
          # not change target word
          if field != "sensekey":
              # skip the replaced targets
              if start in idx_list or end - 1 in idx_list:
                  continue
              targets.append([key, start, end, word, sense])
          # swap target word
          else:
              # target word unchanged
              if [start, end] not in indices:
                  targets.append([key, start, end, word, sense])
              # target word changed
              else:
                  pos = indices.index([start, end])
                  new_sense = " ".join(sensekeys[pos]).split(" ")[0]
                  new_word = " ".join(items[pos])
                  targets.append([key, start, end, new_word, new_sense])
      # reconstruct instances
      setattr(sample, "instance", ListField(targets))
      return sample
  
imports: from .sample import Sample
  from ..field import TextField, ListField
  import json
  from ....common.settings import TASK_MASK, PUNC
  import nltk
label_desc: Use image node_id 18 for calling the WSDSample obj's underlying member method code with example usage: obj.replace_field_at_indices(field, indices, items, pos_list, lemma_list) and returns: sample