<commit_before>///////////////////////////////////////////////////////////
//                                                       //
//  General package                                      //
//                                                       //
// ----------------------------------------------------- //
//                                                       //
//  AUTHOR: <NAME>                          //
//  e-mail: <EMAIL>                  //
//                                                       //
//  Last update: 09/03/2016                              //
//                                                       //
// ----------------------------------------------------- //
//                                                       //
//  Description:                                         //
//                                                       //
//  Template file that contains some utils to work with  //
//  c++ classes.                                         //
//                                                       //
// ----------------------------------------------------- //
///////////////////////////////////////////////////////////


#ifndef __UTILS__
#define __UTILS__

#include <iostream>
#include <vector>
#include <string>
#include <sstream>


//_______________________________________________________________________________ 

namespace General {

  //_______________________________________________________________________________
  // These are different functions
  size_t      CalcIntLength( long int integer );
  std::string CenterString( const std::string &str, const size_t &size );
  void        ParseStringMatch( std::vector<std::string>       &output,
				const std::vector<std::string> &vector,
				const std::string              &expr );
  void        ReplaceNames( std::vector<std::string> &vector, std::string istr, std::string ostr );
  void        SplitString( std::vector<std::string> &output,
			   const std::string        &str,
			   const std::string        &expr );
  
  //_______________________________________________________________________________
  // This function allows to merge two vector so the output vector is the result
  // of the concatenation of both
  template<typename type> std::vector<type> MergeVectors( std::vector<type> vector1,
							  std::vector<type> vector2 ) {
    std::vector<type> ovector( vector1.size() + vector2.size() );
    typename std::vector<type>::iterator
      it1 = vector1.begin(),
      it2 = vector2.begin(),
      oit = ovector.begin();
    
    for ( true; it1 != vector1.end(); it1++, oit++ )
      *oit = *it1;
    for ( true; it2 != vector2.end(); it2++, oit++ )
      *oit = *it2;
    return ovector;
  }

  //_______________________________________________________________________________
  // Prints a given vector
  template<typename type> void PrintVector( std::vector<type> &vector ) {
    std::stringstream ss;
    if ( vector.size() ) {
      ss << "[ " << vector[ 0 ];
      for ( typename std::vector<type>::iterator it = vector.begin() + 1;
	    it != vector.end();
	    it++ )
	ss << ", " << *it;
      ss << " ]";
    }
    else
      ss << "[]";
    std::cout << ss.str() << std::endl;
  }

  //_______________________________________________________________________________
  // Returns a given vector as a string
  template<typename type> std::string VectorToString( std::vector<type> &vector ) {
    std::stringstream ss;
    if ( vector.size() ) {
      ss << "[ " << vector[ 0 ];
      for ( typename std::vector<type>::iterator it = vector.begin() + 1;
	    it != vector.end();
	    it++ )
	ss << ", " << *it;
      ss << " ]";
    }
    else
      ss << "[]";
    return ss.str();
  }
  
}

#endif<commit_msg>Removed function MergeVectors from Utils.h. Also turned to const some of the arguments in other functions.<commit_after>///////////////////////////////////////////////////////////
//                                                       //
//  General package                                      //
//                                                       //
// ----------------------------------------------------- //
//                                                       //
//  AUTHOR: <NAME>                          //
//  e-mail: <EMAIL>                  //
//                                                       //
//  Last update: 09/03/2016                              //
//                                                       //
// ----------------------------------------------------- //
//                                                       //
//  Description:                                         //
//                                                       //
//  Template file that contains some utils to work with  //
//  c++ classes.                                         //
//                                                       //
// ----------------------------------------------------- //
///////////////////////////////////////////////////////////


#ifndef __UTILS__
#define __UTILS__

#include <iostream>
#include <vector>
#include <string>
#include <sstream>


//_______________________________________________________________________________ 

namespace General {

  //_______________________________________________________________________________
  // These are the definitions of different useful functions
  size_t      CalcIntLength( long int integer );
  std::string CenterString( const std::string &str, const size_t &size );
  void        ParseStringMatch( std::vector<std::string>       &output,
				const std::vector<std::string> &vector,
				const std::string              &expr );
  void        ReplaceNames( std::vector<std::string> &vector, std::string istr, std::string ostr );
  void        SplitString( std::vector<std::string> &output,
			   const std::string        &str,
			   const std::string        &expr );
  
  //_______________________________________________________________________________
  // Prints a given vector
  template<typename type> void PrintVector( const std::vector<type> &vector ) {
    std::stringstream ss;
    if ( vector.size() ) {
      ss << "[ " << vector[ 0 ];
      for ( typename std::vector<type>::iterator it = vector.begin() + 1;
	    it != vector.end();
	    it++ )
	ss << ", " << *it;
      ss << " ]";
    }
    else
      ss << "[]";
    std::cout << ss.str() << std::endl;
  }

  //_______________________________________________________________________________
  // Returns a given vector as a string
  template<typename type> std::string VectorToString( const std::vector<type> &vector ) {
    std::stringstream ss;
    if ( vector.size() ) {
      ss << "[ " << vector[ 0 ];
      for ( typename std::vector<type>::iterator it = vector.begin() + 1;
	    it != vector.end();
	    it++ )
	ss << ", " << *it;
      ss << " ]";
    }
    else
      ss << "[]";
    return ss.str();
  }
  
}

#endif
{'fraction_non_alphanumeric': 0.19655172413793104, 'fraction_numerical': 0.005747126436781609, 'mean_word_length': 1.1869305686459315, 'pattern_counts': {'":': 0, '<': 97, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 38, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3706569', 'n_tokens_mistral': 1579, 'n_tokens_neox': 1491, 'n_words': 381}