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: find entities in a sentence with BIOES labels.
  
  :param list token_seq: a list of tokens representing a sentence
  :param list tag_seq: a list of tags representing a tag sequence
      labeling each word of the sentence
  :return list entity_in_seq: a list of entities found in the sequence,
          including the information of the start position & end position
          in the sentence, the category, and the entity itself.
docstr_tok: ["find","entities","in","a","sentence","with","BIOES","labels",".",":","param","list","token_seq",":","a","list","of","tokens","representing","a","sentence",":","param","list","tag_seq",":","a","list","of","tags","representing","a","tag","sequence","labeling","each","word","of","the","sentence",":","return","list","entity_in_seq",":","a","list","of","entities","found","in","the","sequence",",","including","the","information","of","the","start","position","&","end","position","in","the","sentence",",","the","category",",","and","the","entity","itself","."]
code: def find_entities_BMOES(self, token_seq, tag_seq):
      r"""
      find entities in a sentence with BIOES labels.
  
      :param list token_seq: a list of tokens representing a sentence
      :param list tag_seq: a list of tags representing a tag sequence
          labeling each word of the sentence
      :return list entity_in_seq: a list of entities found in the sequence,
              including the information of the start position & end position
              in the sentence, the category, and the entity itself.
  
      """
      entity_in_seq = []
      entity = {"start": 0, "end": 0, "entity": "", "tag": ""}
      temp_entity = ""
      for i in range(len(token_seq)):
          if tag_seq[i][0] == "B":
              assert (
                  temp_entity == ""
              ), "'B' label must be the start of the entity."
              entity["start"] = i
              entity["tag"] = tag_seq[i][2:]
              temp_entity = token_seq[i]
          elif tag_seq[i][0] == "M":
              assert (
                  temp_entity != ""
              ), "'M' label cannot be the start of the entity."
              temp_entity += token_seq[i]
          elif tag_seq[i][0] == "E":
              assert (
                  temp_entity != ""
              ), "'E' label cannot be the start of the entity."
              temp_entity += token_seq[i]
              entity["end"] = i
              entity["entity"] = temp_entity
              entity_in_seq.append(entity)
              entity = {"start": 0, "end": 0, "entity": "", "tag": ""}
              temp_entity = ""
          elif tag_seq[i][0] == "S":
              assert (
                  temp_entity == ""
              ), "'S' label must be the start of the entity."
              entity["start"] = i
              entity["end"] = i
              entity["tag"] = tag_seq[i][2:]
              entity["entity"] = token_seq[i]
              entity_in_seq.append(entity)
              entity = {"start": 0, "end": 0, "entity": "", "tag": ""}
              temp_entity = ""
  
      return entity_in_seq
  
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 7 for calling the NERCnSample obj's underlying member method code with example usage: obj.find_entities_BMOES(token_seq, tag_seq) and returns: entity_in_seq