<commit_before>def clean(text):
    """
    A function for cleaning a string of text.
    Returns valid ASCII characters.
    """
    import re, json, string
    import unicodedata

    # Remove links from message
    text = re.sub(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', '', text)

    # Replace linebreaks with spaces
    text = text.replace("\n", " ").replace("\r", " ").replace("\t", " ")

    # Remove any leeding or trailing whitespace
    text = text.strip()

    # Normalize unicode characters
    text = unicodedata.normalize('NFKD', text).encode('ascii','ignore')

    # Replace html characters with ascii equivilant
    text = text.replace("&amp;", "&")
    text = text.replace("&gt;", ">")<commit_msg>Restored cast on normalized unicode data<commit_after>def clean(text):
    """
    A function for cleaning a string of text.
    Returns valid ASCII characters.
    """
    import re, json, string
    import unicodedata

    # Remove links from message
    text = re.sub(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', '', text)

    # Replace linebreaks with spaces
    text = text.replace("\n", " ").replace("\r", " ").replace("\t", " ")

    # Remove any leeding or trailing whitespace
    text = text.strip()

    # Normalize unicode characters
    text = str(unicodedata.normalize('NFKD', text).encode('ascii','ignore'))

    # Replace html characters with ascii equivilant
    text = text.replace("&amp;", "&")
    text = text.replace("&gt;", ">")
{'fraction_non_alphanumeric': 0.2033678756476684, 'fraction_numerical': 0.007772020725388601, 'mean_word_length': 3.221311475409836, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4793900', 'n_tokens_mistral': 555, 'n_tokens_neox': 524, 'n_words': 123}