code: def read_bio(sample):
      raw_string = ""
      entities = []
      new_entity = None
      prev_bio_type = None
      ptr = 0
  
      # Parse the data from the BIO format
      for ele in sample.split("\n"):
          dat = ele.split()
          if len(dat) != 2:
              continue
          token, bio_label = dat
          raw_string += token
          new_ptr = ptr + len(token)
          if bio_label.startswith("O"):
              bio_type, label = "O", None
          else:
              bio_type, label = bio_label.split("-")
          if bio_type == "O":
              if new_entity:
                  entities.append(new_entity)
              new_entity = None
          elif bio_type == "B":
              if new_entity:
                  entities.append(new_entity)
              new_entity = {
                  "entity_group": label,
                  "start": ptr,
                  "end": new_ptr,
              }
          elif bio_type == "I":
              if prev_bio_type in ["B", "I"]:
                  # Keep update the new_entity
                  assert new_entity["entity_group"] == label
                  new_entity["end"] = new_ptr
              else:
                  new_entity = {
                      "entity_group": label,
                      "start": ptr,
                      "end": new_ptr,
                  }
          else:
              raise NotImplementedError
          ptr = new_ptr
          prev_bio_type = bio_type
      if new_entity:
          entities.append(new_entity)
      return raw_string, entities
  
file_path: autogluon/multimodal/tests/unittests/others_2/test_ner_chinese.py
imports: import json
  import os
  import pandas
  from autogluon.multimodal import MultiModalPredictor
  from autogluon.multimodal.utils import download
  from ..utils.utils import get_home_dir
label_desc: Use image node_id 2 for calling a global function with example usage: read_bio(sample) and returns: raw_string,  entities