<commit_before>export function commentsToNodes(comments, coords) {

  if (!coords) {
    var initCoords;
    //iterate through comments to give
  }

  var nodes = {
    nodes: [],
    links: []
  }
  for(var i = 0; i < comments.length; i++) {
    if (comments[i].parent_id === 'root') {
      var node = { key: comments[i]._id,
                   size: 55,
                   x: coords ? coords[0]['x'] : 600,
                   y: coords ? coords[0]['y']: 250,
                   title: comments[i].title,
                   text: comments[i].text,
                   children: comments[i].children,
                   upvotes: comments[i].upvotes,
                   downvotes: comments[i].downvotes,
                   score: comments[i].score
                 }
      nodes.nodes.push(node);
    } else {
        if (coords) {
          var temp = findIndex(coords, 'key', comments[i].parent_id);
        }
      var node = { key: comments[i]._id,
                   size: 40 + ( 5 * comments[i].score ),
                   x: coords ? (coords[i] ? coords[i]['x'] : coords[temp]['x'] ) : 600,
                   y: coords ? (coords[i] ? coords[i]['y'] : coords[temp]['y'] ) : 250,
                   title: comments[i].title,
                   text: comments[i].text,
                   children: comments[i].children,
                   upvotes: comments[i].upvotes,
                   downvotes: comments[i].downvotes,
                   score: comments[i].score
                 }

      nodes.nodes.push(node);

      //find the index of the node in nodes.nodes whose
      //key matches the parent_id of the current comment
      var index = findIndex(nodes.nodes, 'key', comments[i].parent_id);

      var link = { source: nodes.nodes.length - 1,
                   target: index,
                   key: comments[i]._id,
                   size: 2
                 };
      nodes.links.push(link);
    }
  }
  return nodes;
}

function findIndex(array, attr, value) {
  for (var i = 0; i < array.length; i++) {
    if (array[i][attr]===value) {
      return i
    }
  }
  return -1
}

export function splitText(string) {
  string = string.split(" ");
  var mid = Math.floor(string.length / 2)
  var first = string.slice(0, mid).join(' ');
  var second = string.slice(mid).join(' ');
  return [first, second]

}

export function randomBlue() {
  var blues = ['#aedee0', '#b0d0cf', '#cae9ea', '#c7e2e1'];
  var random = Math.floor(Math.random() * 4);
  return blues[random];
}<commit_msg>Update random blue tones<commit_after>export function commentsToNodes(comments, coords) {

  if (!coords) {
    var initCoords;
    //iterate through comments to give
  }

  var nodes = {
    nodes: [],
    links: []
  }
  for(var i = 0; i < comments.length; i++) {
    if (comments[i].parent_id === 'root') {
      var node = { key: comments[i]._id,
                   size: 55,
                   x: coords ? coords[0]['x'] : 600,
                   y: coords ? coords[0]['y']: 250,
                   title: comments[i].title,
                   text: comments[i].text,
                   children: comments[i].children,
                   upvotes: comments[i].upvotes,
                   downvotes: comments[i].downvotes,
                   score: comments[i].score
                 }
      nodes.nodes.push(node);
    } else {
        if (coords) {
          var temp = findIndex(coords, 'key', comments[i].parent_id);
        }
      var node = { key: comments[i]._id,
                   size: 40 + ( 5 * comments[i].score ),
                   x: coords ? (coords[i] ? coords[i]['x'] : coords[temp]['x'] ) : 600,
                   y: coords ? (coords[i] ? coords[i]['y'] : coords[temp]['y'] ) : 250,
                   title: comments[i].title,
                   text: comments[i].text,
                   children: comments[i].children,
                   upvotes: comments[i].upvotes,
                   downvotes: comments[i].downvotes,
                   score: comments[i].score
                 }

      nodes.nodes.push(node);

      //find the index of the node in nodes.nodes whose
      //key matches the parent_id of the current comment
      var index = findIndex(nodes.nodes, 'key', comments[i].parent_id);

      var link = { source: nodes.nodes.length - 1,
                   target: index,
                   key: comments[i]._id,
                   size: 2
                 };
      nodes.links.push(link);
    }
  }
  return nodes;
}

function findIndex(array, attr, value) {
  for (var i = 0; i < array.length; i++) {
    if (array[i][attr]===value) {
      return i
    }
  }
  return -1
}

export function splitText(string) {
  string = string.split(" ");
  var mid = Math.floor(string.length / 2)
  var first = string.slice(0, mid).join(' ');
  var second = string.slice(mid).join(' ');
  return [first, second]

}

export function randomBlue() {
  var blues = ['#aedee0', '#afd9dd', '#cae9ea', '#c7e2e1'];
  var random = Math.floor(Math.random() * 4);
  return blues[random];
}
{'fraction_non_alphanumeric': 0.14779308967445576, 'fraction_numerical': 0.013381266227281806, 'mean_word_length': 1.7217391304347827, 'pattern_counts': {'":': 0, '<': 7, '<?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': '723981', 'n_tokens_mistral': 1638, 'n_tokens_neox': 1535, 'n_words': 365}