code: def paragraph_tokenize(
      text,
      join_sentences=False,
      join_tokens=True,
      join_char=" ",
      lang=None,
  ):
      """
      ```
      segment text into paragraphs
      ```
      """
      lang = detect_lang(text) if lang is None else lang
      if is_chinese(lang):
          raise ValueError(
              "paragraph_tokenize does not currently support Chinese."
          )
      paragraphs = []
      sents = []
      for paragraph in segmenter.process(text):
          sents = []
          for sentence in paragraph:
              sents.append(
                  join_char.join([t.value for t in sentence])
                  if join_tokens
                  else [t.value for t in sentence]
              )
          if join_sentences and join_tokens:
              sents = join_char.join(sents)
          elif join_sentences and not join_tokens:
              sents = [item for sublist in sents for item in sublist]
          paragraphs.append(sents)
      # 20220715: moved to tokenize due to text/qa/core.py usage
      # paragraphs = paragraphs[0] if len(paragraphs) == 1 else paragraphs
      return paragraphs
  
imports: from subprocess import DEVNULL, PIPE, Popen
  from ..imports import *
label_desc: Use image node_id 21 for calling a global function with example usage: paragraph_tokenize(text, join_sentences, join_tokens, join_char, lang) and returns: paragraphs