<commit_before>#!/usr/bin/env node

var sesico = require('./lib');

// TODO: It would be nice if Cheerio could parse a stream directly,
// but it seems that it is not possible. In the meantime, we read the
// whole stream into a string.

function readStreamIntoString (stream, callback){
  var output = '';
  stream.on('data', function(data){ output += data; });
  stream.on('end', function(){ callback(null, output); });
  stream.on('error', callback);
}

readStreamIntoString(process.stdin, function(err, input){
  var $ = sesico(input);
  $.use('./sesico');
  process.stdout.write( $.html() );
  process.stdout.write('\n');
});<commit_msg>command line tool loads sesico.js file from current directory<commit_after>#!/usr/bin/env node

var path = require('path');
var sesico = require('./lib');

// TODO: It would be nice if Cheerio could parse a stream directly,
// but it seems that it is not possible. In the meantime, we read the
// whole stream into a string.

function readStreamIntoString (stream, callback){
  var output = '';
  stream.on('data', function(data){ output += data; });
  stream.on('end', function(){ callback(null, output); });
  stream.on('error', callback);
}

readStreamIntoString(process.stdin, function(err, input){
  var $ = sesico(input);
  $.use(path.join(process.cwd(), 'sesico'));
  process.stdout.write( $.html() );
  process.stdout.write('\n');
});
{'fraction_non_alphanumeric': 0.17196531791907516, 'fraction_numerical': 0.0, 'mean_word_length': 4.431372549019608, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1800521', 'n_tokens_mistral': 422, 'n_tokens_neox': 421, 'n_words': 134}