def clean_up_tokenization(text):
    """
    Clean up a list of simple English tokenization artifacts like spaces
    before punctuations and abreviated forms.

    From https://github.com/huggingface/transformers/blob/master/src/transformers/tokenization_utils.py#L1400
    """
    despace_substrings = [".", "?", "!", ",", "'", "n't", "'m", "'s", "'ve", "'re"]
    for s in despace_substrings:
        text = text.replace(f" {s}", f"{s}")

    replacements = {"do not":"don't"}
    for k,v in replacements:
        text = text.replace(f" {k}", f" {v}")
    return text