<commit_before>var fs = require('fs');
var path = require('path');

var svgOutput = {"path": "lib/svg/",
"prefix": "",
"suffix": "",
"table": []
};

var start = new Date().getTime();
var lastTime = start;

var parseSVGPaths = function(directory,i){
  var directoryStat = fs.statSync(directory);
  if(directoryStat.isDirectory()){
    if (!fs.existsSync(outputDirectory+"/"+directory.replace("chtml/",""))){
      if(directory == "chtml"){

      } else {
          fs.mkdirSync(outputDirectory+"/"+directory.replace("chtml/",""));
      }
    }
  }
  var dir = fs.readdirSync(directory);
  for(i=0;i<dir.length;i++){
          var itemPath = directory + '/' + dir[i];
          var stats = fs.statSync(itemPath);
          if(stats.isDirectory()){
            console.log("Starting new directory: " + itemPath);
            parseSVGPaths(itemPath);
          } else {
            if(path.extname(itemPath) == ".svg"){
              var currentTime = new Date().getTime();
              var fileTime = currentTime - lastTime;
              console.log(itemPath + " | " + (fileTime) + "ms");
              lastTime = currentTime;

              var partStart = itemPath.indexOf("p");
              var svgPath = itemPath.slice(partStart);
              var outputPath = outputDirectory+"/"+itemPath.replace("chtml/","");

              fs.createReadStream(itemPath).pipe(fs.createWriteStream(outputPath));
              svgOutput.table.push({Title : svgPath, Name : svgPath});
            }
          }
    }
};

var directoryInput = process.argv[2];
var outputDirectory = process.argv[3];
if(outputDirectory === undefined || directoryInput === undefined){
  console.log("The program accepts arguments:");
  console.log("node linkanchorparse.js <input directory> <outputDirectorypath>");
} else {
  if (!fs.existsSync(outputDirectory)){
      fs.mkdirSync(outputDirectory);
  }
	parseSVGPaths(directoryInput);

	var jsonsvgOutput = "dataList = " + JSON.stringify(svgOutput) + ";";

  var outputSVGListPath = outputDirectory + "/svg.js";

	fs.writeFile(outputSVGListPath, jsonsvgOutput, function(err) {
	  if(err) {
		  return console.log(err);
	  }

	  console.log("The file was saved!");
	  var end = new Date().getTime();
	  var elapsed = end-start;
	  console.log("Operation took: " + elapsed + "ms");
	});
}
<commit_msg>Minor change<commit_after>var fs = require('fs');
var path = require('path');

var svgOutput = {"path": "lib/svg/",
"prefix": "",
"suffix": "",
"table": []
};

var start = new Date().getTime();
var lastTime = start;

var parseSVGPaths = function(directory,i){
  var directoryStat = fs.statSync(directory);
  if(directoryStat.isDirectory()){
    if (!fs.existsSync(outputDirectory+"/"+directory.replace("chtml/",""))){
      if(directory == "chtml"){

      } else {
          fs.mkdirSync(outputDirectory+"/"+directory.replace("chtml/",""));
      }
    }
  }
  var dir = fs.readdirSync(directory);
  for(i=0;i<dir.length;i++){
          var itemPath = directory + '/' + dir[i];
          var stats = fs.statSync(itemPath);
          if(stats.isDirectory()){
            console.log("Starting new directory: " + itemPath);
            parseSVGPaths(itemPath);
          } else {
            if(path.extname(itemPath) == ".svg"){
              var currentTime = new Date().getTime();
              var fileTime = currentTime - lastTime;
              console.log(itemPath + " | " + (fileTime) + "ms");
              lastTime = currentTime;

              var partStart = itemPath.indexOf("part");
              var svgPath = itemPath.slice(partStart);
              var outputPath = outputDirectory+"/"+itemPath.replace("chtml/","");

              fs.createReadStream(itemPath).pipe(fs.createWriteStream(outputPath));
              svgOutput.table.push({Title : svgPath, Name : svgPath});
            }
          }
    }
};

var directoryInput = process.argv[2];
var outputDirectory = process.argv[3];
if(outputDirectory === undefined || directoryInput === undefined){
  console.log("The program accepts arguments:");
  console.log("node linkanchorparse.js <input directory> <outputDirectorypath>");
} else {
  if (!fs.existsSync(outputDirectory)){
      fs.mkdirSync(outputDirectory);
  }
	parseSVGPaths(directoryInput);

	var jsonsvgOutput = "dataList = " + JSON.stringify(svgOutput) + ";";

  var outputSVGListPath = outputDirectory + "/svg.js";

	fs.writeFile(outputSVGListPath, jsonsvgOutput, function(err) {
	  if(err) {
		  return console.log(err);
	  }

	  console.log("The file was saved!");
	  var end = new Date().getTime();
	  var elapsed = end-start;
	  console.log("Operation took: " + elapsed + "ms");
	});
}

{'fraction_non_alphanumeric': 0.16401205337925095, 'fraction_numerical': 0.0012914334911752045, 'mean_word_length': 2.978595890410959, 'pattern_counts': {'":': 8, '<': 9, '<?xml version=': 0, '>': 7, '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': '5740716', 'n_tokens_mistral': 1449, 'n_tokens_neox': 1392, 'n_words': 267}