<commit_before>// this script visualizes text reuse, using
// json from an ANN algorithm contained in
// /utils/. For more information, see:
// https://github.com/duhaime/visualizing-text-reuse

// width and height for the scatter plot and time axis
var margin = {top: 90, right: 420, left: 70, bottom: 50};   
var timeMargin = {top:45, right: 0, left: 5, bottom: 0};
var w = 800 - margin.left - margin.right;
var h = 355 - margin.top - margin.bottom;

// function that makes the plotting call
var makePlotCall = function(sourceId){
  var alignmentsDir = "json/alignments/"; 
  var alignmentsFile = sourceId + "_alignments.json";
  var alignmentsPath = alignmentsDir + alignmentsFile
  $.getJSON( alignmentsPath, function( jsonResponse ) {
    makeScatterPlot( jsonResponse );
  });
};  


// function that takes as input an array of dicts
// [{"similarId":0,"title":"A"}...] and returns an 
// array of dicts that contains only one 
// observation for each similarId. 
var uniquify = function(arr) {
  var ids = [];
  var result = [];

  // add information on the input text first to ensure
  // the selected text appears first in the key 
  if (arr.length > 0) {
    result.push({"similarYear":arr[0].sourceYear,
        "similarId":arr[0].sourceId,
        "similarTitle":arr[0].sourceTitle}
    );
  };

  var indx=-1;
  for(var i=0; i< arr.length; i++){
    indx = ids.indexOf(arr[i].similarId);
    if(indx==-1){
      ids.push(arr[i].similarId);
      result.push(arr[i]);
    }
  }

  return result;
};
<commit_msg>removed whitespace<commit_after>// this script visualizes text reuse, using
// json from an ANN algorithm contained in
// /utils/. For more information, see:
// https://github.com/duhaime/visualizing-text-reuse

// width and height for the scatter plot and time axis
var margin = {top: 90, right: 420, left: 70, bottom: 50};   
var timeMargin = {top:45, right: 0, left: 5, bottom: 0};
var w = 800 - margin.left - margin.right;
var h = 355 - margin.top - margin.bottom;

// function that makes the plotting call
var makePlotCall = function(sourceId){
  var alignmentsDir = "json/alignments/"; 
  var alignmentsFile = sourceId + "_alignments.json";
  var alignmentsPath = alignmentsDir + alignmentsFile
  $.getJSON( alignmentsPath, function( jsonResponse ) {
    makeScatterPlot( jsonResponse );
  });
};  

// function that takes as input an array of dicts
// [{"similarId":0,"title":"A"}...] and returns an 
// array of dicts that contains only one 
// observation for each similarId. 
var uniquify = function(arr) {
  var ids = [];
  var result = [];
  // add information on the input text first to ensure
  // the selected text appears first in the key 
  if (arr.length > 0) {
    result.push({"similarYear":arr[0].sourceYear,
        "similarId":arr[0].sourceId,
        "similarTitle":arr[0].sourceTitle}
    );
  };
  var indx=-1;
  for(var i=0; i< arr.length; i++){
    indx = ids.indexOf(arr[i].similarId);
    if(indx==-1){
      ids.push(arr[i].similarId);
      result.push(arr[i]);
    }
  }
  return result;
};

{'fraction_non_alphanumeric': 0.14112241549064652, 'fraction_numerical': 0.018378733180177225, 'mean_word_length': 3.2569832402234637, 'pattern_counts': {'":': 10, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '5175944', 'n_tokens_mistral': 1039, 'n_tokens_neox': 955, 'n_words': 307}