<commit_before>/* eslint clusterfck:false */

self.onmessage = function (event) {
  let error;
  let clusters;

  const kmeans = new clusterfck.Kmeans(event.data.centroids || []);

  try {
    clusters = kmeans.cluster(event.data.data, event.data.numClusters || 3);
  } catch (e) {
    error = e.message;
  }

  self.postMessage({
    clusters,
    error
  });
};<commit_msg>Return matrix ids only<commit_after>/* eslint clusterfck:false */

self.onmessage = function (event) {
  let error;
  let clusters = [];

  const kmeans = new clusterfck.Kmeans(event.data.centroids || []);

  try {
    clusters = kmeans.cluster(event.data.data, event.data.numClusters || 3);
  } catch (e) {
    error = e.message;
  }

  clusters = clusters.map(cluster => cluster.map(entry => entry.id));

  self.postMessage({
    clusters,
    error
  });
};
{'fraction_non_alphanumeric': 0.1532934131736527, 'fraction_numerical': 0.0023952095808383233, 'mean_word_length': 3.2436548223350252, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7367040', 'n_tokens_mistral': 300, 'n_tokens_neox': 289, 'n_words': 59}