docstr: Check whether 'sentence1', 'sentence2 and 'y' is legal
  
  :param dict data: contains 'sentence1', 'sentence2', 'y' keys.
  :return:
docstr_tok: ["Check","whether","'sentence1","'",",","'sentence2","and","'","y","'","is","legal",":","param","dict","data",":","contains","'sentence1","'",",","'sentence2","'",",","'","y","'","keys",".",":","return",":"]
code: def check_data(self, data):
      r"""
      Check whether 'sentence1', 'sentence2 and 'y' is legal
  
      :param dict data: contains 'sentence1', 'sentence2', 'y' keys.
      :return:
  
      """
      assert "words" in data and isinstance(
          data["words"], list
      ), "words should be in data, and the type of context should be list"
      assert "pos" in data and isinstance(
          data["pos"], list
      ), "pos should be in data, and the type of context should be list"
      assert "heads" in data and isinstance(
          data["heads"], list
      ), "heads should be in data, and the type of context should be list"
      assert "labels" in data and isinstance(
          data["labels"], list
      ), "labels should be in data, and the type of context should be list"
  
imports: from .cnsample import CnSample
  from ..field import ListField, Field
  from ....common.settings import ORIGIN, TASK_MASK, MODIFIED_MASK
label_desc: Use image node_id 8 for calling the DPCnSample obj's underlying member method code with example usage: obj.check_data(data) without return types