code: def split_trailing_punct(
      text: str, punctuation: Optional[List[str]] = None
  ) -> str:
      """Some tokenizers, including that in Stanza, do not always
      handle punctuation properly. For example, a trailing colon (``"οἶδα:"``)
      is not split into an extra punctuation token. This function
      does such splitting on raw text before being sent to such
      a tokenizer.
  
      Args:
          text: Input text string.
          punctuation: List of punctuation that should be split when trailing a word.
  
      Returns:
          Text string with trailing punctuation separated by a whitespace character.
  
      >>> raw_text = "κατηγόρων’, οὐκ οἶδα: ἐγὼ δ᾽ οὖν"
      >>> split_trailing_punct(text=raw_text)
      'κατηγόρων ’, οὐκ οἶδα : ἐγὼ δ᾽ οὖν'
      """
      if not punctuation:
          # What about the curly thing (``᾽``) in eg ``δ᾽``
          punctuation = [":", "’", "”"]  # closing curly quotes
      new_chars: List[str] = list()
      for index, char in enumerate(text):
          if char in punctuation and index > 0:
              # Check whether the punct is attached to a word end
              prev_char = text[index - 1]
              # If a space already before the punct, then don't add space
              if prev_char.isspace():
                  new_chars.append(char)
              else:
                  # If no whitespace before, then do the split
                  new_chars.append(f" {char}")
          else:
              new_chars.append(char)
      return "".join(new_chars)
  
file_path: cltk/src/cltk/alphabet/text_normalization.py
imports: from typing import List, Optional
  from unicodedata import normalize
label_desc: Use image node_id 4 for calling a global function with example usage: split_trailing_punct(text, punctuation) and returns: str