import re
import string


def normalize_string(s):
    """Lower text and remove punctuation, articles and extra whitespace."""
    def remove_articles(text):
        text = " " + re.sub(r'(\[PAD\]|\[UNK\]|\[CLS\]|\[SEP\]|\[MASK\])', ' ', text) + " "
        text = text.replace(" a ", " ").replace(" an ", " ").replace(" the ", " ")
        return text

    def white_space_fix(text):
        return ' '.join(text.split())

    def remove_punc(text):
        exclude = set(string.punctuation)
        res = ""
        for ch in text:
            if ch in exclude:
                res += " "
            else:
                res += ch
        return res

    return white_space_fix(remove_articles(remove_punc(s)))