<commit_before>#ifndef GUARD_utils_h
#define GUARD_utils_h

#include <iostream>
#include <string>
#include <boost/numeric/ublas/matrix.hpp>
#include "cluster.h"
#include "suffstats.h"

void LoadData(std::string file, boost::numeric::ublas::matrix<double>& M);

std::ostream& operator<<(std::ostream& os, const std::map<int, double>& int_double_map);

std::string int_to_str(int i);

template <class T>
std::string stringify_set(std::set<T> st) {
  typename std::set<T>::iterator it = st.begin();
  if(it==st.end()) return "{}";
  //
  std::string ret_string = "{";
  ret_string += int_to_str(*it);
  it++;
  for(; it!=st.end(); it++) {
    ret_string += ", " + int_to_str(*it);
  }
  ret_string += "}";
  return ret_string;
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T> sT) {
  typename std::set<T>::const_iterator it = sT.begin();
  os << "{";
  if(it==sT.end()) {
    os << "}";
    return os;
  }
  os << *it;
  it++;
  for(; it!=sT.end(); it++) {
    os << ", " << *it;
  }
  os << "}";
  return os;
}

#endif // GUARD_utils_H<commit_msg>add std::vector printer<commit_after>#ifndef GUARD_utils_h
#define GUARD_utils_h

#include <iostream>
#include <string>
#include <boost/numeric/ublas/matrix.hpp>
#include "cluster.h"
#include "suffstats.h"

void LoadData(std::string file, boost::numeric::ublas::matrix<double>& M);

std::ostream& operator<<(std::ostream& os, const std::map<int, double>& int_double_map);

std::string int_to_str(int i);

template <class T>
std::string stringify_set(std::set<T> st) {
  typename std::set<T>::iterator it = st.begin();
  if(it==st.end()) return "{}";
  //
  std::string ret_string = "{";
  ret_string += int_to_str(*it);
  it++;
  for(; it!=st.end(); it++) {
    ret_string += ", " + int_to_str(*it);
  }
  ret_string += "}";
  return ret_string;
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T> sT) {
  typename std::set<T>::const_iterator it = sT.begin();
  os << "{";
  if(it==sT.end()) {
    os << "}";
    return os;
  }
  os << *it;
  it++;
  for(; it!=sT.end(); it++) {
    os << ", " << *it;
  }
  os << "}";
  return os;
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T> vT) {
  typename std::vector<T>::const_iterator it = vT.begin();
  os << "{";
  if(it==vT.end()) {
    os << "}";
    return os;
  }
  os << *it;
  it++;
  for(; it!=vT.end(); it++) {
    os << ", " << *it;
  }
  os << "}";
  return os;
}

#endif // GUARD_utils_H
{'fraction_non_alphanumeric': 0.22721798474508229, 'fraction_numerical': 0.0, 'mean_word_length': 4.170124481327801, 'pattern_counts': {'":': 0, '<': 74, '<?xml version=': 0, '>': 28, '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': '4052308', 'n_tokens_mistral': 1007, 'n_tokens_neox': 995, 'n_words': 200}