import re


def clean_data(text):
    """
    Accepts a single text document and performs several regex
    substitutions in order to clean the document. Currently not used.
    May potentially be used in the future to clean training data and 
    tweets

    Parameters
    ----------
    text: string or object
    Returns
    -------
    text: string or object
    """
    special_chars_regex = '[:?,\>$|!\'"]'
    white_spaces_regex = '[ ]{2,}'
    text = re.sub('[^a-zA-Z ]', "", text)
    text = re.sub(special_chars_regex, " ", text)
    text = re.sub(white_spaces_regex, " ", text)
    text = text.replace('\n', '%20')
    text = re.sub(r'http\S+', '', text)
    return text.lower()