code: def tokenize(self, text: str) -> List[Token]:
      output_tokens: List[Token] = []
  
      sentence_split = [""]
      is_escape = False
      is_special_token = False
      for i, c in enumerate(text):
          if is_special_token:
              if c == "<":
                  raise ValueError(
                      "Invalid special token at pos {}".format(i)
                  )
              elif c == ">":
                  # end of special token
                  sentence_split[-1] += c
                  is_special_token = False
                  sentence_split.append("")
              else:
                  sentence_split[-1] += c
          else:
              if c == "<":
                  if is_escape:
                      # case: <<
                      sentence_split[-1] += c
                      is_escape = False
                  else:
                      # case: x<
                      is_escape = True
              else:
                  if is_escape:
                      # case <x
                      is_special_token = True
                      is_escape = False
                      sentence_split.append("<" + c)
                  else:
                      # case xx
                      sentence_split[-1] += c
      if is_escape or is_special_token:
          raise ValueError("Unexpected end of text `{}`".format(text))
  
      part_pos = 0
      for i, part in enumerate(sentence_split):
          if (i & 1) == 1:
              # special token
              output_tokens.append(Token(part, part_pos, False, True))
          else:
              part_st = 0
              last_unk = None
              while part_st < len(part):
                  piece = self.get_piece(part[part_st:])
                  if piece not in self.encoder:
                      if last_unk is None:
                          last_unk = piece
                      else:
                          last_unk += piece
                  else:
                      if last_unk is None:
                          output_tokens.append(
                              Token(
                                  piece,
                                  part_st + part_pos,
                                  False,
                                  False,
                              )
                          )
                      else:
                          output_tokens.append(
                              Token(
                                  last_unk,
                                  part_st + part_pos - len(last_unk),
                                  True,
                                  False,
                              )
                          )
                          output_tokens.append(
                              Token(
                                  piece,
                                  part_st + part_pos,
                                  False,
                                  False,
                              )
                          )
                          last_unk = None
                  part_st += len(piece)
              if last_unk is not None:
                  # part end with UNK
                  output_tokens.append(
                      Token(
                          last_unk,
                          part_st + part_pos - len(last_unk),
                          True,
                          False,
                      )
                  )
          part_pos += len(part)
      return output_tokens
  
imports: import pkg_resources
  import io
  from typing import IO, Dict, List, Optional, Tuple
label_desc: Use image node_id 9 for calling the CPMBeeTokenizer obj's underlying member method code with example usage: obj.tokenize(text) and returns: output_tokens