class_docstr: DP Sample class to hold the data info and provide atomic operations.
docstr: Convert data dict to DPSample and get matched brackets.
  
  :param dict data: contains 'word', 'postag', 'head', 'deprel' keys.
docstr_tok: ["Convert","data","dict","to","DPSample","and","get","matched","brackets",".",":","param","dict","data",":","contains","'word","'",",","'postag","'",",","'head","'",",","'deprel","'","keys","."]
code: def load(self, data):
      r"""
      Convert data dict to DPSample and get matched brackets.
  
      :param dict data: contains 'word', 'postag', 'head', 'deprel' keys.
  
      """
      assert (
          data["deprel"][-1] == "punct"
      ), "The sentence should end with a punctuation."
      words = data["word"]
      self.x = TextField(words)
      self.postag = ListField(data["postag"])
      self.head = ListField(data["head"])
      self.deprel = ListField(data["deprel"])
  
      try:
          left_bras = []
          match_bracket = []
          for i, word in enumerate(words):
              if word == "-LRB-":
                  left_bras.append(i + 1)
              if word == "-RRB-":
                  match_bracket.append((left_bras[-1], i + 1))
                  left_bras.pop(-1)
      except IndexError:
          raise TypeError("Missing matched brackets.")
      else:
          if left_bras:
              raise TypeError("Missing matched brackets.")
          else:
              self.brackets = match_bracket
  
      if not self.is_legal():
          raise ValueError("The postag data is not aligned with words.")
  
file_path: textflint/textflint/input/component/sample/dp_sample.py
imports: from .sample import Sample
  from ..field import ListField, TextField
  from ....common.utils.list_op import get_align_seq, normalize_scope
label_desc: Use image node_id 4 for calling the DPSample obj's underlying member method code with example usage: obj.load(data) without return types