class_docstr: WSDSample Class
class_docstr_tok: ["WSDSample","Class"]
docstr: Validate whether the sample is legal
  :return bool
docstr_tok: ["Validate","whether","the","sample","is","legal",":","return","bool"]
code: def is_legal(self):
      r"""
      Validate whether the sample is legal
      :return bool
      """
      # get attribute value
      sentence = self.sentence.field_value
      instance = self.instance.field_value
      # check instance:
      if len(instance) > 0:
          for key, start, end, word, _ in instance:
              if key is None or key == "":
                  return False
              if start >= end:
                  return False
              # check target word
              if word.lower() != " ".join(sentence[start:end]).lower():
                  return False
      return True
  
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 4 for calling the WSDSample obj's underlying member method code with example usage: obj.is_legal() and returns: True, False, False, False