class_docstr: ABSASample Class
class_docstr_tok: ["ABSASample","Class"]
docstr: Check the format of input data.
  
  :param dict data: data name
docstr_tok: ["Check","the","format","of","input","data",".",":","param","dict","data",":","data","name"]
code: def check_data(self, data):
      r"""
      Check the format of input data.
  
      :param dict data: data name
  
      """
      assert "sentence" in data and isinstance(
          data["sentence"], str
      ), "Sentence should be in data, and type of sentence should be str."
      assert "term_list" in data and isinstance(
          data["term_list"], dict
      ), "Term_list should be in data, and type of term_list should be dict."
  
      for term_id, term_dict in data["term_list"].items():
          assert isinstance(
              term_id, str
          ), "Type of key of items in term_list should be str."
          assert isinstance(
              term_dict, dict
          ), "Type of value of items in term_list should be dict."
          assert (
              "polarity" in term_dict
              and isinstance(term_dict["polarity"], str)
              and len(term_dict["polarity"]) > 0
          ), (
              "Polarity should be in term_list, "
              "type of polarity should be str, "
              "and length of polarity should larger than 0."
          )
  
          assert (
              "term" in term_dict
              and isinstance(term_dict["term"], str)
              and len(term_dict["term"]) > 0
          ), (
              "Term should be in term_list, "
              "type of term should be str and length of term "
              "should larger than 0."
          )
          assert (
              "from" in term_dict
              and isinstance(term_dict["from"], int)
              and term_dict["from"] >= 0
          ), (
              "From should be in term_list, and from should be "
              "an int not less than 0."
          )
  
          assert (
              "to" in term_dict
              and isinstance(term_dict["to"], int)
              and term_dict["to"] >= 0
          ), (
              "To should be in term_list, and to should be "
              "an int not less than 0."
          )
          assert (
              "opinion_words" in term_dict
              and isinstance(term_dict["opinion_words"], list)
              and len(term_dict["opinion_words"]) > 0
          ), (
              "Opinion_words should be in term_list, "
              "and type of opinion_words should be list "
              "and the length of opinion_words should larger than 0."
          )
  
          for opinion_word in term_dict["opinion_words"]:
              assert (
                  isinstance(opinion_word, str)
                  and len(opinion_word) > 0
              ), (
                  "The type of elements of opinion_words should be str "
                  "and their length should larger than 0."
              )
          assert (
              "opinion_position" in term_dict
              and isinstance(term_dict["opinion_position"], list)
              and len(term_dict["opinion_position"]) > 0
          ), (
              "Opinion_position should be in term_list, "
              "type of opinion_position should be str, "
              "and the length of opinion_position should larger than 0."
          )
  
          for positions in term_dict["opinion_position"]:
              assert (
                  isinstance(positions, list) and len(positions) == 2
              ), (
                  "The type of elements of opinion_position should be list "
                  "and its length should be 2."
              )
              for position in positions:
                  assert (
                      position >= 0
                  ), "Opinion position should be not less than 0."
              assert positions[1] > positions[0], (
                  "The end position of opinion word should larger than "
                  "its start position."
              )
  
imports: from .sample import Sample
  from ..field import TextField
  from ....common.utils.error import FlintError
label_desc: Use image node_id 3 for calling the ABSASample obj's underlying member method code with example usage: obj.check_data(data) without return types