class_docstr: CNNER Sample class to hold the necessary info and provide atomic operations.
  the input x can be a sentence or a list of single words,
  while y being a list of tags aligned to each word in x.
  
  Example::
      1. {'x':'上海浦东开发与法制建设同步', 'y':'['B-GPE','E-GPE','B-GPE','E-GPE','O','O','O','O','O','O','O','O','O']'}
  
      2. {
          'x':['上','海','浦','东','开','发','与','法','制','建','设','同','步'],
          'y':['B-GPE','E-GPE','B-GPE',E'-GPE','O','O','O','O','O','O','O','O','O']
         }
class_docstr_tok: ["CNNER","Sample","class","to","hold","the","necessary","info","and","provide","atomic","operations",".","the","input","x","can","be","a","sentence","or","a","list","of","single","words",",","while","y","being","a","list","of","tags","aligned","to","each","word","in","x",".","Example",":",":","1",".","{","'","x","'",":","'\u4e0a\u6d77\u6d66\u4e1c\u5f00\u53d1\u4e0e\u6cd5\u5236\u5efa\u8bbe\u540c\u6b65","'",",","'","y","'",":","'","[","'","B-GPE","'",",","'","E-GPE","'",",","'","B-GPE","'",",","'","E-GPE","'",",","'","O","'",",","'","O","'",",","'","O","'",",","'","O","'",",","'","O","'",",","'","O","'",",","'","O","'",",","'","O","'",",","'","O","'","]","'","}","2",".","{","'","x","'",":","[","'","\u4e0a","'",",","'","\u6d77","'",",","'","\u6d66","'",",","'","\u4e1c","'",",","'","\u5f00","'",",","'","\u53d1","'",",","'","\u4e0e","'",",","'","\u6cd5","'",",","'","\u5236","'",",","'","\u5efa","'",",","'","\u8bbe","'",",","'","\u540c","'",",","'","\u6b65","'","]",",","'","y","'",":","[","'","B-GPE","'",",","'","E-GPE","'",",","'","B-GPE","'",",","E'-GPE","'",",","'","O","'",",","'","O","'",",","'","O","'",",","'","O","'",",","'","O","'",",","'","O","'",",","'","O","'",",","'","O","'",",","'","O","'","]","}"]
docstr: Check rare data format.
  1.  'x' in data and type(x) being str|list
  2.  'y' in data and type(y) being list
  3.  len(data['x']) == len(data['y'])
  4.  mode check
  5. check BMOES
docstr_tok: ["Check","rare","data","format",".","1",".","'","x","'","in","data","and","type","(","x",")","being","str|list","2",".","'","y","'","in","data","and","type","(","y",")","being","list","3.","len","(","data","[","'","x","'","]",")","==","len","(","data","[","'","y","'","]",")","4.","mode","check","5.","check","BMOES"]
code: def check_data(self, data):
      r"""
      Check rare data format.
      1.  'x' in data and type(x) being str|list
      2.  'y' in data and type(y) being list
      3.  len(data['x']) == len(data['y'])
      4.  mode check
      5. check BMOES
  
      """
      assert "x" in data and isinstance(
          data["x"], (str, list)
      ), r"Type of 'x' should be 'str' or 'list'"
  
      assert "y" in data and isinstance(
          data["y"], (list)
      ), r"Type of 'y' should be 'list'"
  
      assert len(data["x"]) == len(
          data["y"]
      ), r"The number of words is not equal to the number of tags"
  
      assert (
          self.mode == "BMOES"
      ), "Not support {0} type, plz ensure mode in {1}".format(
          self.mode, ["BMOES"]
      )
      for tag in data["y"]:
          assert tag[0] in [
              "B",
              "M",
              "O",
              "E",
              "S",
          ], "tags should start with B/M/O/E/S in mode BMOES"
          assert tag == "O" or (
              tag[0] != "O" and tag[1] == "-"
          ), "entity labels should be like the format 'X-XXX'."
  
file_path: textflint/textflint/input/component/sample/nercn_sample.py
imports: from .cnsample import CnSample
  from ..field import ListField, CnTextField
  from ....common.utils.list_op import get_align_seq
label_desc: Use image node_id 4 for calling the NERCnSample obj's underlying member method code with example usage: obj.check_data(data) without return types