code: def _preprocess(
      doc,
      lower=False,
      remove_non_alphanumeric=False,
      delimiter=" ",
      keep_underscore_char=True,
      remove_single_token_len=True,
  ):
      """
      Chain together an optional series of text preprocessing steps to
      apply to a document.
  
      Parameters
      ----------
      doc: cudf.Series[str] or pd.Series[str]
          The string to preprocess
      lower: bool
          Whether to use str.lower to lowercase all of the text
      remove_non_alphanumeric: bool
          Whether or not to remove non-alphanumeric characters.
      keep_underscore_char: bool
          Whether or not to keep the underscore character
  
      Returns
      -------
      doc: cudf.Series[str]
          preprocessed string
      """
      if isinstance(doc, pd.Series):
          doc = Series(doc)
      if lower:
          doc = doc.str.lower()
      if remove_non_alphanumeric:
          if keep_underscore_char:
              # why: sklearn by default keeps `_` char along with  alphanumerics
              # currently we dont have a easy way of removing
              # all chars but `_`
              # in cudf.Series[str] below works around it
              temp_string = "cumlSt"
              doc = doc.str.replace("_", temp_string, regex=False)
              doc = doc.str.filter_alphanum(" ", keep=True)
              doc = doc.str.replace(temp_string, "_", regex=False)
          else:
              doc = doc.str.filter_alphanum(" ", keep=True)
  
          # sklearn by default removes tokens of
          # length 1, if its remove alphanumerics
          if remove_single_token_len:
              doc = doc.str.filter_tokens(2)
  
      return doc
  
imports: from cuml.internals.safe_imports import cpu_only_import
  import cuml.internals.logger
  from cudf.utils.dtypes import min_signed_type
  from cuml.internals.type_utils import CUPY_SPARSE_DTYPES
  import numbers
  from cuml.internals.safe_imports import gpu_only_import
  from functools import partial
  from cuml.common.sparsefuncs import create_csr_matrix_from_count_df
  from cuml.common.sparsefuncs import csr_row_normalize_l1, csr_row_normalize_l2
  from cuml.feature_extraction._stop_words import ENGLISH_STOP_WORDS
  from cuml.common.exceptions import NotFittedError
  from cuml.internals.safe_imports import gpu_only_import_from
label_desc: Use image node_id 1 for calling a global function with example usage: _preprocess(doc, lower, remove_non_alphanumeric, delimiter, keep_underscore_char, remove_single_token_len) and returns: doc