<commit_before>'use strict';

let chalk = require('chalk'),
  defaults = require('defaults'),
  path = require('path'),
  strftime = require('strftime'),
  through = require('through2').obj,
  util = require('util');

module.exports = function(opts) {

  opts = defaults(opts, {
    'prefix': false,
    'postfix': false,
    'count': true,
    'log': true,
    'format': 'Processing file ' + chalk.magenta('%s'),
    'timestamp': '[' + chalk.gray('%H:%M:%S') + ']',
    'many-format': 'Processed %d files',
    'one-format': 'Processed 1 file',
    'zero-format': 'No files processed'
  });

  let files = 0;

  let log = function(message) {
    let items = [ message ];
    if (opts.postfix) {
      items.push(opts.postfix);
    }
    if (opts.prefix) {
      items.unshift(opts.prefix);
    }
    if (opts.timestamp) {
      items.unshift(strftime(opts.timestamp));
    }
    console.log.apply(console, items);
  };

  let logChunk = function(chunk, encoding, callback) {
    files++;
    if (opts.log && opts.format) {
      log(util.format(opts.format, path.relative('', chunk.path)));
    }
    this.push(chunk);  // eslint-disable-line no-invalid-this
    return callback();
  };

  let logFlush = function(callback) {
    let format = ['zero-format', 'one-format'][files] || 'many-format';
    if (opts.log && opts.count && opts[format]) {
      log((files > 1) ? util.format(opts[format], files) : opts[format]);
    }
    return callback();
  };

  return through(logChunk, logFlush);
};<commit_msg>adjust function names<commit_after>'use strict';

let chalk = require('chalk'),
  defaults = require('defaults'),
  path = require('path'),
  strftime = require('strftime'),
  through = require('through2').obj,
  util = require('util');

module.exports = function(opts) {
  opts = defaults(opts, {
    'prefix': false,
    'postfix': false,
    'count': true,
    'log': true,
    'format': 'Processing file ' + chalk.magenta('%s'),
    'timestamp': '[' + chalk.gray('%H:%M:%S') + ']',
    'many-format': 'Processed %d files',
    'one-format': 'Processed 1 file',
    'zero-format': 'No files processed'
  });

  let files = 0;

  let log = function(message) {
    let items = [ message ];
    if (opts.postfix) {
      items.push(opts.postfix);
    }
    if (opts.prefix) {
      items.unshift(opts.prefix);
    }
    if (opts.timestamp) {
      items.unshift(strftime(opts.timestamp));
    }
    console.log.apply(console, items);
  };

  let onChunk = function(chunk, encoding, callback) {
    files++;
    if (opts.log && opts.format) {
      log(util.format(opts.format, path.relative('', chunk.path)));
    }
    this.push(chunk);  // eslint-disable-line no-invalid-this
    return callback();
  };

  let onFlush = function(callback) {
    let format = ['zero-format', 'one-format'][files] || 'many-format';
    if (opts.log && opts.count && opts[format]) {
      log((files > 1) ? util.format(opts[format], files) : opts[format]);
    }
    return callback();
  };

  return through(onChunk, onFlush);
};
{'fraction_non_alphanumeric': 0.1885544161429044, 'fraction_numerical': 0.0026463777704267286, 'mean_word_length': 3.1538461538461537, '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': '269564', 'n_tokens_mistral': 1026, 'n_tokens_neox': 1000, 'n_words': 210}