import re
import string


def _apply_punctuation_pipeline(text):
    """
    Applies a the punctuation pipeline to a text.

    Parameters
    ----------
    text : str
        Text to preprocess.

    Returns
    -------
    text : str
        Preprocessed text.
    additional_metric : float
        Preprocessing amount metric.

    """
    additional_metric = len(re.findall('[%s]' % re.escape(
        string.punctuation), text)) / max(len(text), 1)
    text = re.sub('[%s]' % re.escape(string.punctuation), '', text)
    return text, additional_metric