import re
import string


def clean(text):
    """
    text: a string object
    output: the cleaned string object
    
    The function performs basic text cleaning operations including making text
    lower case, removing non-sensical text, removing puctuation, and
    removing words containing numbers.
    """
    """
    The data cleaning process is modified from the following source:
        Title: 1-Data-Cleaning, NLP in Python Tutorial
        Author: Alice Zhao
        Date: 2018
        Availability: https://github.com/adashofdata/nlp-in-python-tutorial/blob/master/1-Data-Cleaning.ipynb
    """    
    text = text.lower()
    text = re.sub("\n", "", text)
    text = re.sub("\[.*?\]", " ", text)
    text = re.sub("[%s]" % re.escape(string.punctuation), "", text)
    text = re.sub("\w*\d\w*", "", text)
    text = re.sub("[‘’“”…ł]", " ", text)
    text = re.sub("[˜˚˛˝˙œ™]", "", text)
    return text