<commit_before>var AbstractSerializer = require('./AbstractSerializer.js');

var SetSerializer = function SetSerializer(tamp) {

  initTamp(tamp);

  this.tamp = tamp;
};

//Extend the AbstractSerializer
SetSerializer.prototype = Object.create(AbstractSerializer.prototype);
SetSerializer.prototype.AbstractSerializer = AbstractSerializer;

function initTamp(tamp) {
  tamp();
};

SetSerializer.prototype.serialize = function serialize(objectsToSet) {
  var _this = this,
      values,
      el,
      key,
      hashMap = {};

  //creates a hash of keys with each value being an array
  objectsToSet.forEach(function(obj){
    if (_this._isObject(obj)) {
      for (key in obj) {
        hashMap[key] = hashMap[key] || [];
        hashMap[key].push(obj[key])
      }
      return hashMap;
    }
  });

  //takes all values, returns only unique values, and add to array
  for (el in hashMap) {
    values = hashMap[el].filter(_this._onlyUniqueKeys);
    hashMap[el] = values;
  }

  this._pack(hashMap)

};

SetSerializer.prototype._pack = function _pack(preSerializedObj) {
  var _this = this,
      tampSerializer = this.tamp;


};
<commit_msg>Implements _packData(), successfully packing data and setCategoricalData() is completely working.<commit_after>var AbstractSerializer = require('./AbstractSerializer.js');

var SetSerializer = function SetSerializer(tamp) {
  this.tamp = tamp;
};

//Extend the AbstractSerializer
SetSerializer.prototype = Object.create(AbstractSerializer.prototype);
SetSerializer.prototype.AbstractSerializer = AbstractSerializer;


SetSerializer.prototype.serialize = function serialize(objectsToSet) {
  var _this = this,
      values,
      el,
      key,
      packedData,
      hashMap = {};

  //creates a hash of keys with each value being an array
  objectsToSet.forEach(function(obj){
    if (_this._isObject(obj)) {
      for (key in obj) {
        hashMap[key] = hashMap[key] || [];
        hashMap[key].push(obj[key])
      }
      return hashMap;
    }
  });

  //takes all values, returns only unique values, and add to array
  for (el in hashMap) {
    values = hashMap[el].filter(_this._onlyUniqueKeys);
    hashMap[el] = values;
  }

  //console.log('Objects', objectsToSet);

  // pack all data
  packedData = this._packData(hashMap, objectsToSet);

  return packedData;
};

SetSerializer.prototype._packData = function _packData(preSerializedObj, rawPreSerializedData) {
  var _this = this,
      el,
      newPack,
      tamp = this.tamp,
      packer = tamp();

  // Adds packed attributes
  for (el in preSerializedObj) {
    packer.addAttribute({
      attrName: el,
      possibilities: preSerializedObj[el],
      maxChoices: 1
    })
  }
  // Packs the raw data
  packer.pack(rawPreSerializedData);

  return packer;
};

{'fraction_non_alphanumeric': 0.11415196254951386, 'fraction_numerical': 0.00036010082823190496, 'mean_word_length': 3.3748031496062993, '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': '2056371', 'n_tokens_mistral': 859, 'n_tokens_neox': 840, 'n_words': 203}