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]
        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 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