<commit_before><commit_msg>[module] add a script that returns an object all the data in the chapters folder<commit_after>var fs = require('fs');
var path = require('path');
//
// {
//   chapterName: {
//     users: [ userObject, otherUserObject]
//     events: []
//   }
// }
//
// Synchronously create the resources object that contains
// the hierarchy of the folders with at the core level it contains
// arrays of the file paths to the resources
//
var chaptersDir = path.join(__dirname, 'chapters');

var chapters = fs.readDirSync(chaptersDir);

module.exports = chapters.reduce(function (acc, chapter) {
  var chapterDir = path.join(chaptersDir, chapter);
  acc[chapter] = fs.readDirSync(chapterDir).reduce(function (paths, resource) {
    var resourceDir = path.join(chapterDir, resource);
    paths[resource] = fs.readDirSync(resourceDir).map(function(file) {
      return path.join(resourceDir, file);
    });
    return paths;
  }, {});
  return acc;
}, {});
{'fraction_non_alphanumeric': 0.1384297520661157, 'fraction_numerical': 0.0, 'mean_word_length': 3.893939393939394, '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': '4295377', 'n_tokens_mistral': 288, 'n_tokens_neox': 282, 'n_words': 84}