<commit_before>import re

from twisted.python import log


def clean_formatting(message):
    """Remove formatting codes from a Weechat message."""

    # I have no idea why they use \x19, but at least they are consistent.
    clean = re.sub(r'\x19F\d\d', '', message)
    clean = re.sub(r'\x1C', '', clean)

    # I'm not sure if all the format codes are \x19F, so yell if
    # something was missed.
    if '\x19' in clean:
        log.err('Unknown format character in "%r".' % clean)
    if '\x1c' in clean:
        log.err('Unknown format character in "%r".' % clean)

    return clean<commit_msg>Added irc-formating codes that need cleaning out.<commit_after>import re

from twisted.python import log


def clean_formatting(message):
    """Remove formatting codes from a Weechat message."""

    # I have no idea why they use \x19, but at least they are consistent.
    clean = re.sub(r'\x19F\d\d', '', message)
    clean = re.sub(r'\x1C', '', clean)
    clean = re.sub(r'\x1A', '', clean) # Used to indicate start of bold formating. Possibly replace with <bold>?
    clean = re.sub(r'\x1B', '', clean) # Used to indicate end of bold formating. Possibly replace with </bold>?
    clean = re.sub(r'\x01', '', clean)

    # I'm not sure if all the format codes are \x19F, so yell if
    # something was missed.
    if '\x19' in clean:
        log.err('Unknown format character in "%r".' % clean)
    if '\x1c' in clean:
        log.err('Unknown format character in "%r".' % clean)
    if '\x1a' in clean:
	log.err('Unknown format character in "%r".' % clean)
    if '\x1b' in clean:
	log.err('Unknown format character in "%r".' % clean)
    if '\x01' in clean:
        log.err('Unknown format character in "%r".' % clean)


    return clean
{'fraction_non_alphanumeric': 0.13761467889908258, 'fraction_numerical': 0.016055045871559634, 'mean_word_length': 2.8950892857142856, 'pattern_counts': {'":': 0, '<': 5, '<?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': '52999', 'n_tokens_mistral': 577, 'n_tokens_neox': 553, 'n_words': 212}