<commit_before>#include "DictCreator.hpp"

using namespace std;

//----------------------------------------------------------
DictCreator::DictCreator(string path_n)
{
	esm_ptr = &esm_n;
	message_ptr = &message_n;

	mode = yampt::ins_mode::RAW;

	esm_n.readFile(path_n);

	if(esm_n.getStatus() == true)
	{
		status = true;
	}
}

//----------------------------------------------------------
DictCreator::DictCreator(string path_n, string path_f)
{
	esm_ptr = &esm_f;
	message_ptr = &message_f;

	mode = yampt::ins_mode::BASE;

	esm_n.readFile(path_n);
	esm_f.readFile(path_f);

	if(esm_n.getStatus() == true && esm_f.getStatus() == true)
	{
		status = compareEsm();
	}
}

//----------------------------------------------------------
DictCreator::DictCreator(string path_n, DictMerger &merger, yampt::ins_mode mode)
{
	this->merger = &merger;
	this->mode = mode;

	esm_ptr = &esm_n;
	message_ptr = &message_n;

	esm_n.readFile(path_n);

	if(esm_n.getStatus() == true && merger.getStatus() == true)
	{
		status = true;
	}
}

//----------------------------------------------------------
void DictCreator::makeDict()
{
	if(status == true)
	{
		printLog("", true);
		makeDictCELL();
		makeDictGMST();
		makeDictFNAM();
		makeDictDESC();
		makeDictTEXT();
		makeDictRNAM();
		makeDictINDX();
		makeDictDIAL();
		makeDictINFO();
		makeDictBNAM();
		makeDictSCPT();
		cout << endl;
	}
}

//----------------------------------------------------------
void DictCreator::printLog(string id, bool header)
{
	if(header == true)
	{
		cout << endl;
		cout << "          CREATED / DOUBLED /    ALL" << endl;
		cout << "    --------------------------------" << endl;
	}
	else
	{
		cout << "    " << id << " "
		     << setw(8) << to_string(counter[0]) << " / "
		     << setw(7) << to_string(counter[1]) << " / "
		     << setw(6) << to_string(counter[2]) << endl;

		if(id == "GMST" || id == "FNAM")
		{
			cout << "     + CELL"
			     << setw(6) << to_string(counter_extra[0]) << " / "
			     << setw(7) << to_string(counter_extra[1]) << " / "
			     << setw(6) << to_string(counter_extra[2]) << endl;
		}
	}
}

//----------------------------------------------------------
bool DictCreator::compareEsm()
{
	if(esm_n.getRecColl().size() != esm_f.getRecColl().size())
	{
		cout << "--> They are not the same master files!\r\n";
		return false;
	}
	else
	{
		string esm_n_compare;
		string esm_f_compare;

		for(size_t i = 0; i < esm_n.getRecColl().size(); ++i)
		{
			esm_n_compare += esm_n.getRecId();
		}

		for(size_t i = 0; i < esm_f.getRecColl().size(); ++i)
		{
			esm_f_compare += esm_f.getRecId();
		}

		if(esm_n_compare != esm_f_compare)
		{
			cout << "--> They are not the same master files!\r\n";<commit_msg>fix compareEsm secondary check<commit_after>#include "DictCreator.hpp"

using namespace std;

//----------------------------------------------------------
DictCreator::DictCreator(string path_n)
{
	esm_ptr = &esm_n;
	message_ptr = &message_n;

	mode = yampt::ins_mode::RAW;

	esm_n.readFile(path_n);

	if(esm_n.getStatus() == true)
	{
		status = true;
	}
}

//----------------------------------------------------------
DictCreator::DictCreator(string path_n, string path_f)
{
	esm_ptr = &esm_f;
	message_ptr = &message_f;

	mode = yampt::ins_mode::BASE;

	esm_n.readFile(path_n);
	esm_f.readFile(path_f);

	if(esm_n.getStatus() == true && esm_f.getStatus() == true)
	{
		status = compareEsm();
	}
}

//----------------------------------------------------------
DictCreator::DictCreator(string path_n, DictMerger &merger, yampt::ins_mode mode)
{
	this->merger = &merger;
	this->mode = mode;

	esm_ptr = &esm_n;
	message_ptr = &message_n;

	esm_n.readFile(path_n);

	if(esm_n.getStatus() == true && merger.getStatus() == true)
	{
		status = true;
	}
}

//----------------------------------------------------------
void DictCreator::makeDict()
{
	if(status == true)
	{
		printLog("", true);
		makeDictCELL();
		makeDictGMST();
		makeDictFNAM();
		makeDictDESC();
		makeDictTEXT();
		makeDictRNAM();
		makeDictINDX();
		makeDictDIAL();
		makeDictINFO();
		makeDictBNAM();
		makeDictSCPT();
		cout << endl;
	}
}

//----------------------------------------------------------
void DictCreator::printLog(string id, bool header)
{
	if(header == true)
	{
		cout << endl;
		cout << "          CREATED / DOUBLED /    ALL" << endl;
		cout << "    --------------------------------" << endl;
	}
	else
	{
		cout << "    " << id << " "
		     << setw(8) << to_string(counter[0]) << " / "
		     << setw(7) << to_string(counter[1]) << " / "
		     << setw(6) << to_string(counter[2]) << endl;

		if(id == "GMST" || id == "FNAM")
		{
			cout << "     + CELL"
			     << setw(6) << to_string(counter_extra[0]) << " / "
			     << setw(7) << to_string(counter_extra[1]) << " / "
			     << setw(6) << to_string(counter_extra[2]) << endl;
		}
	}
}

//----------------------------------------------------------
bool DictCreator::compareEsm()
{
	if(esm_n.getRecColl().size() != esm_f.getRecColl().size())
	{
		cout << "--> They are not the same master files!\r\n";
		return false;
	}
	else
	{
		string esm_n_compare;
		string esm_f_compare;

		for(size_t i = 0; i < esm_n.getRecColl().size(); ++i)
		{
			esm_n.setRec(i);
			esm_n_compare += esm_n.getRecId();
		}

		for(size_t i = 0; i < esm_f.getRecColl().size(); ++i)
		{
			esm_f.setRec(i);
			esm_f_compare += esm_f.getRecId();
		}

		if(esm_n_compare != esm_f_compare)
		{
			cout << "--> They are not the same master files!\r\n";
{'fraction_non_alphanumeric': 0.3047375160051216, 'fraction_numerical': 0.005121638924455826, 'mean_word_length': 1.9492988133764833, 'pattern_counts': {'":': 0, '<': 127, '<?xml version=': 0, '>': 11, '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': '6469222', 'n_tokens_mistral': 2200, 'n_tokens_neox': 2041, 'n_words': 324}