class_docstr: NER Sample class to hold the necessary info and provide atomic operations.
class_docstr_tok: ["NER","Sample","class","to","hold","the","necessary","info","and","provide","atomic","operations","."]
docstr: find entities in a sentence with BIOES labels.
  
  :param list word_seq: a list of tokens representing a sentence
  :param list tag_seq: a list of tags representing a tag sequence
      labeling 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","word_seq",":","a","list","of","tokens","representing","a","sentence",":","param","list","tag_seq",":","a","list","of","tags","representing","a","tag","sequence","labeling","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_BIOES(self, word_seq, tag_seq):
      r"""
      find entities in a sentence with BIOES labels.
  
      :param list word_seq: a list of tokens representing a sentence
      :param list tag_seq: a list of tags representing a tag sequence
          labeling 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(word_seq)):
          assert tag_seq[i][0] in ["B", "I", "O", "E", "S"], (
              "entity labels should be started with "
              "'B' or 'I' or 'O' or 'E' or 'S'."
          )
          if not tag_seq[i] == "O":
              assert (
                  tag_seq[i][1] == "-"
              ), "entity labels should be like the format 'X-XXX'."
          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 = word_seq[i]
          elif tag_seq[i][0] == "I":
              assert (
                  temp_entity != ""
              ), "'I' label cannot be the start of the entity."
              temp_entity += " " + word_seq[i]
          elif tag_seq[i][0] == "E":
              assert (
                  temp_entity != ""
              ), "'E' label cannot be the start of the entity."
              temp_entity += " " + word_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["entity"] = word_seq[i]
              entity_in_seq.append(entity)
              entity = {"start": 0, "end": 0, "entity": "", "tag": ""}
              temp_entity = ""
  
      return entity_in_seq
  
imports: from .sample import Sample
  from ..field import ListField, TextField
  from ....common.utils.list_op import get_align_seq
label_desc: Use image node_id 14 for calling the NERSample obj's underlying member method code with example usage: obj.find_entities_BIOES(word_seq, tag_seq) and returns: entity_in_seq