<commit_before>module.exports = function( parsed ) {
  var slugify = function(text) {
    return text
      .toLowerCase()
      .replace(/ /g,'-')
      .replace(/[^\w-]+/g,'');
  };
  // Set up a property on parsed.map if it hasn't already been set.
  if ( !parsed.maps.hasOwnProperty('slugs') ) {
    parsed.maps.slugs = {
      prop: 'slugs',
      indexes: {},
      get: function( slug, parsed ) {
        var indexPath = parsed.maps[this.prop].indexes[slug];
        var returnDoc;
        if ( indexPath.length === 2 ) {
          returnDoc = parsed.files[indexPath[0]][indexPath[1]];
        } else if ( indexPath.length === 3 ) {
          returnDoc = parsed.files[indexPath[0]][indexPath[1]].docs[indexPath[2]];
        }
        return returnDoc;
      }
    };
  }
  // Loop through all code files in each doc/code pair of each file.
  parsed.files.forEach(function( file, fileIndex ){
    var currentHeader = '';
    file.forEach(function( docCodePair, docCodePairIndex ){
      if ( Array.isArray( docCodePair.docs ) ) {
        docCodePair.docs.forEach(function( doc, docIndex ){
          doc.slug = slugify(doc.label);
          // If there is a header property prepend it to the slug. This is an
          // effort to make slugs mor unique.
          if ( doc.header ) {
            currentHeader = doc.slug;
          } else if ( currentHeader !== '' ) {
            doc.slug = currentHeader + '-' + doc.slug;
          }
          // Save the indexes needed to get to this slug.
          parsed.maps.slugs.indexes[doc.slug] = [fileIndex, docCodePairIndex, docIndex];
        });
      } else {
        docCodePair.docs.slug = slugify(docCodePair.docs.label);
        // Save the indexes needed to get to this slug.
        parsed.maps.slugs.indexes[docCodePair.docs.slug] = [fileIndex, docCodePairIndex];
      }
    });
  });
  return parsed;
};<commit_msg>Formatting tweaks.<commit_after>module.exports = function( parsed ) {
  var slugify = function(text) {
    return text
      .toLowerCase()
      .replace(/ /g,'-')
      .replace(/[^\w-]+/g,'');
  };
  // Set up a property on parsed.map if it hasn't already been set.
  if ( !parsed.maps.hasOwnProperty('slugs') ) {
    parsed.maps.slugs = {
      prop: 'slugs',
      indexes: {},
      get: function( slug, parsed ) {
        var indexPath = parsed.maps[this.prop].indexes[slug];
        var returnDoc;
        if ( indexPath.length === 2 ) {
          returnDoc = parsed.files[indexPath[0]][indexPath[1]];
        } else if ( indexPath.length === 3 ) {
          returnDoc = parsed.files[indexPath[0]][indexPath[1]].docs[indexPath[2]];
        }
        return returnDoc;
      }
    };
  }
  // Loop through all code files in each doc/code pair of each file.
  parsed.files.forEach(function( file, fileIndex ){
    var currentHeader = '';
    file.forEach(function( docCodePair, docCodePairIndex ){
      // Some docs are arrays of docs, some are just doc objects.
      // If it's an array of docs, loop through it.
      if ( Array.isArray( docCodePair.docs ) ) {
        docCodePair.docs.forEach(function( doc, docIndex ){
          doc.slug = slugify( doc.label );
          // If there is a header property prepend it to the slug. This is an
          // effort to make slugs mor unique.
          if ( doc.header ) {
            currentHeader = doc.slug;
          } else if ( currentHeader !== '' ) {
            doc.slug = currentHeader + '-' + doc.slug;
          }
          // Save the indexes needed to get to this slug.
          parsed.maps.slugs.indexes[ doc.slug ] = [ fileIndex, docCodePairIndex, docIndex ];
        });
      } else {
        docCodePair.docs.slug = slugify( docCodePair.docs.label );
        // Save the indexes needed to get to this slug.
        parsed.maps.slugs.indexes[ docCodePair.docs.slug ] = [ fileIndex, docCodePairIndex ];
      }
    });
  });
  return parsed;
};
{'fraction_non_alphanumeric': 0.134462406979728, 'fraction_numerical': 0.00359250705671029, 'mean_word_length': 2.1359613837489944, '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': '3788605', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1196, 'n_words': 305}