<commit_before>#!/usr/bin/env python
import sys

from .shared import get_config, configure_logging

def main():
    if len(sys.argv) < 2:
        sys.stderr.write("usage: smr-reduce config.py\n")
        sys.exit(1)

    config = get_config(sys.argv[1])
    configure_logging(config)

    try:
        for result in iter(sys.stdin.readline, ""):
            config.REDUCE_FUNC(result.rstrip()) # remove trailing linebreak
    except (KeyboardInterrupt, SystemExit):
        # we want to output results even if user aborted
        config.OUTPUT_RESULTS_FUNC()
    else:
        config.OUTPUT_RESULTS_FUNC()<commit_msg>add some extra debug logging to smr-reduce<commit_after>#!/usr/bin/env python
import sys

from .shared import get_config, configure_logging

def main():
    if len(sys.argv) < 2:
        sys.stderr.write("usage: smr-reduce config.py\n")
        sys.exit(1)

    config = get_config(sys.argv[1])
    configure_logging(config)

    try:
        for result in iter(sys.stdin.readline, ""):
            result = result.rstrip() # remove trailing linebreak
            logging.debug("smr-reduce got %s", result)
            config.REDUCE_FUNC(result)
    except (KeyboardInterrupt, SystemExit):
        # we want to output results even if user aborted
        config.OUTPUT_RESULTS_FUNC()
    else:
        config.OUTPUT_RESULTS_FUNC()
{'fraction_non_alphanumeric': 0.10682492581602374, 'fraction_numerical': 0.004451038575667656, 'mean_word_length': 2.843304843304843, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2586275', 'n_tokens_mistral': 420, 'n_tokens_neox': 409, 'n_words': 101}