code: def split_sentence(
      document: str, flag: str = "all", limit: int = 510
  ) -> List[str]:
      sent_list = []
      try:
          if flag == "zh":
              document = re.sub(
                  "(?P<quotation_mark>([。？！…](?![”’\"'])))",
                  r"\g<quotation_mark>\n",
                  document,
              )
              document = re.sub(
                  "(?P<quotation_mark>([。？！]|…{1,2})[”’\"'])",
                  r"\g<quotation_mark>\n",
                  document,
              )
          elif flag == "en":
              document = re.sub(
                  "(?P<quotation_mark>([.?!](?![”’\"'])))",
                  r"\g<quotation_mark>\n",
                  document,
              )
              document = re.sub(
                  "(?P<quotation_mark>([?!.][\"']))",
                  r"\g<quotation_mark>\n",
                  document,
              )  # Special quotation marks
          else:
              document = re.sub(
                  "(?P<quotation_mark>([。？！….?!](?![”’\"'])))",
                  r"\g<quotation_mark>\n",
                  document,
              )
  
              document = re.sub(
                  "(?P<quotation_mark>(([。？！.!?]|…{1,2})[”’\"']))",
                  r"\g<quotation_mark>\n",
                  document,
              )  # Special quotation marks
  
          sent_list_ori = document.splitlines()
          for sent in sent_list_ori:
              sent = sent.strip()
              if not sent:
                  continue
              elif len(sent) <= 2:
                  continue
              else:
                  while len(sent) > limit:
                      temp = sent[0:limit]
                      sent_list.append(temp)
                      sent = sent[limit:]
                  sent_list.append(sent)
      except:
          sent_list.clear()
          sent_list.append(document)
      return sent_list
  
file_path: ColossalAI/examples/community/roberta/preprocessing/sentence_split.py
imports: import argparse
  import functools
  import json
  import multiprocessing
  import os
  import re
  import time
  from typing import List
  from tqdm import tqdm
label_desc: Use image node_id 1 for calling a global function with example usage: split_sentence(document, flag, limit) and returns: sent_list