class_docstr: transform and retrieve features of RESample
docstr: Validate whether the sample is legal
docstr_tok: ["Validate","whether","the","sample","is","legal"]
code: def is_legal(self):
      r"""
      Validate whether the sample is legal
  
      """
      sent_len = len(self.x.words)
      if not isinstance(self.y, str):
          return False
      if len(self.subj) != 2 or len(self.obj) != 2:
          return False
      if (
          self.subj[0] < 0
          or self.subj[1] >= sent_len
          or self.obj[0] < 0
          and self.obj[1] >= sent_len
      ):
          return False
      if self.subj[0] > self.subj[1] or self.obj[0] > self.obj[1]:
          return False
      if self.subj[0] > self.subj[1] or self.obj[0] > self.obj[1]:
          return False
      for word in self.x.words:
          if word == "":
              return False
      return True
  
imports: import random
  import copy
  from .sample import Sample
  from ..field import TextField
  from ....common.settings import TASK_MASK
label_desc: Use image node_id 4 for calling the RESample obj's underlying member method code with example usage: obj.is_legal() and returns: True, False, False, False, False, False, False