code: def tlg_plaintext_cleanup(
      text, rm_punctuation=False, rm_periods=False
  ):
      """Remove and substitute post-processing for Greek TLG text.
      TODO: Surely more junk to pull out. Please submit bugs!
      """
      remove_comp = regex.compile(
          r"-\n|[«»<>〈〉\(\)‘’_—:!\?\'\"\*]|{[[:print:][:space:]]+?}|\[[[:print:][:space:]]+?\]|[a-zA-Z0-9]",
          flags=regex.VERSION1,
      )
      text = remove_comp.sub("", text)
  
      if rm_punctuation:
          punct_comp = regex.compile(r",|·")
          text = punct_comp.sub("", text)
  
      if rm_periods:
          period_comp = regex.compile(r"\.|;")
          text = period_comp.sub("", text)
  
      # replace line breaks w/ space
      replace_comp = regex.compile(r"\n")
      text = replace_comp.sub(" ", text)
  
      comp_space = regex.compile(r"\s+")
      text = comp_space.sub(" ", text)
  
      return text
  
imports: import os
  import regex
  from cltk.corpora.grc.tlg.tlg_index import TLG_INDEX, TLG_WORKS_INDEX
  from cltk.utils.file_operations import make_cltk_path
label_desc: Use image node_id 1 for calling a global function with example usage: tlg_plaintext_cleanup(text, rm_punctuation, rm_periods) and returns: text