code: def preprocess_text(
      input: TextPreprocessingInput,
  ) -> TextProcessingOutput:
      """Clean up text data based on selected preprocessing steps."""
  
      text = input.text
  
      if (
          PreprocessingStep.REMOVE_SPECIAL_CHARACTERS
          in input.preprocessing_steps
      ):
          text = re.sub(r"\W", " ", text)
  
      if (
          PreprocessingStep.REMOVE_SINGLE_CHARACTERS
          in input.preprocessing_steps
      ):
          text = re.sub(r"\s+[a-zA-Z]\s+", " ", text)
  
      if (
          PreprocessingStep.CLEAN_MULTIPLE_SPACES
          in input.preprocessing_steps
      ):
          text = re.sub(r"\s+", " ", text, flags=re.I)
  
      if PreprocessingStep.LOWERCASE in input.preprocessing_steps:
          text = text.lower()
  
      if (
          PreprocessingStep.REMOVE_STOP_WORDS
          in input.preprocessing_steps
      ):
          tokens = text.split()
          tokens = [
              word for word in tokens if word not in EN_STOP_WORDS
          ]
          text = " ".join(tokens)
  
      return TextProcessingOutput(preprocessed_text=text)
  
file_path: opyrator/examples/preprocess_text/app.py
imports: import re
  from enum import Enum
  from typing import Set
  import nltk
  from pydantic import BaseModel, Field
label_desc: Use image node_id 1 for calling a global function with example usage: preprocess_text(input) and returns: TextProcessingOutput