class_docstr: Our segmentation rules are based on ctb6.
  
  the input x can be a list or a sentence
  the input y is segmentation label include:B,M,E,S
  the y also can automatic generation,if you want automatic generation
      you must input an empty list and x must each word in x is separated by
      a space or split into each element of the list
  Note that punctuation should be separated into a single word
  
  Example::
  
      1. input {'x':'小明好想送Jo圣诞礼物', 'y' = ['B', 'E', 'B', 'E', 'S', 'B',
          'E', 'B', 'E', 'B', 'E']}
      2. input {'x':['小明','好想送Jo圣诞礼物'], 'y' = ['B', 'E', 'B', 'E', 'S',
          'B', 'E', 'B', 'E', 'B', 'E']}
      3. input {'x':'小明 好想 送 Jo 圣诞 礼物', 'y' = []}
      4. input {'x':['小明', '好想', '送', 'Jo', '圣诞', '礼物'], 'y' = []}
class_docstr_tok: ["Our","segmentation","rules","are","based","on","ctb6",".","the","input","x","can","be","a","list","or","a","sentence","the","input","y","is","segmentation","label","include",":","B",",","M",",","E",",","S","the","y","also","can","automatic","generation",",","if","you","want","automatic","generation","you","must","input","an","empty","list","and","x","must","each","word","in","x","is","separated","by","a","space","or","split","into","each","element","of","the","list","Note","that","punctuation","should","be","separated","into","a","single","word","Example",":",":","1.","input","{","'","x","'",":","'\u5c0f\u660e\u597d\u60f3\u9001Jo\u5723\u8bde\u793c\u7269","'",",","'","y","'","=","[","'","B","'",",","'","E","'",",","'","B","'",",","'","E","'",",","'S","'",",","'","B","'",",","'","E","'",",","'","B","'",",","'","E","'",",","'","B","'",",","'","E","'","]","}","2.","input","{","'","x","'",":","[","'\u5c0f\u660e","'",",","'\u597d\u60f3\u9001Jo\u5723\u8bde\u793c\u7269","'","]",",","'","y","'","=","[","'","B","'",",","'","E","'",",","'","B","'",",","'","E","'",",","'S","'",",","'","B","'",",","'","E","'",",","'","B","'",",","'","E","'",",","'","B","'",",","'","E","'","]","}","3.","input","{","'","x","'",":","'\u5c0f\u660e","\u597d\u60f3","\u9001","Jo","\u5723\u8bde","\u793c\u7269","'",",","'","y","'","=","[","]","}","4.","input","{","'","x","'",":","[","'\u5c0f\u660e","'",",","'\u597d\u60f3","'",",","'","\u9001","'",",","'Jo","'",",","'\u5723\u8bde","'",",","'\u793c\u7269","'","]",",","'","y","'","=","[","]","}"]
docstr: Check whether the position of change is legal.
  
  :param list indices: The list of the pos need to be changed.
  :param list new_items: The list of the item need to be changed.
  :param list y_new_items: The list of the mask info need to be changed.
  :return three list: legal position, change items, change labels.
docstr_tok: ["Check","whether","the","position","of","change","is","legal",".",":","param","list","indices",":","The","list","of","the","pos","need","to","be","changed",".",":","param","list","new_items",":","The","list","of","the","item","need","to","be","changed",".",":","param","list","y_new_items",":","The","list","of","the","mask","info","need","to","be","changed",".",":","return","three","list",":","legal","position",",","change","items",",","change","labels","."]
code: def check(self, indices, new_items, y_new_items=None):
      r"""
      Check whether the position of change is legal.
  
      :param list indices: The list of the pos need to be changed.
      :param list new_items: The list of the item need to be changed.
      :param list y_new_items: The list of the mask info need to be changed.
      :return three list: legal position, change items, change labels.
      """
  
      assert len(indices) == len(new_items)
      legal_indices = []
      legal_items = []
      mask_change = []
      legal_y = []
      mask = self.mask
      for i in range(len(indices)):
          flag = True
          if isinstance(indices[i], list):
              for j in range(indices[i][0], indices[i][1]):
                  if mask[j] != ORIGIN:
                      flag = False
                      break
          else:
              if mask[indices[i]] != ORIGIN:
                  flag = False
          if flag:
              legal_indices.append(indices[i])
              legal_items.append(new_items[i])
              if y_new_items:
                  legal_y.append(y_new_items[i])
              if isinstance(new_items[i], list):
                  change = []
                  for k in new_items[i]:
                      change += [MODIFIED_MASK] * len(k)
                  mask_change.append(change)
              else:
                  mask_change.append(
                      [MODIFIED_MASK] * len(new_items[i])
                  )
  
      return legal_indices, legal_items, mask_change, legal_y
  
imports: from .sample import Sample
  from ..field.cn_text_field import CnTextField
  from ..field import ListField
  from ....common.settings import ORIGIN, MODIFIED_MASK
  from ....common.utils.list_op import *
label_desc: Use image node_id 13 for calling the CWSSample obj's underlying member method code with example usage: obj.check(indices, new_items, y_new_items) and returns: legal_indices,  legal_items,  mask_change,  legal_y