<commit_before>#include "featuresmanager.h"

#include <functional>
#include <fstream>
#include "exchangemanager.h"
#include "features.h"

static const unsigned int MIN_SEQUENCE_SIZE = 5; // Otherwise, the sequence is ignored

bool replace(std::string &str, const std::string &from, const std::string &to)
{
    size_t start_pos = str.find(from);
    if(start_pos == std::string::npos)
        return false;
    str.replace(start_pos, from.length(), to);
    return true;
}

FeaturesManager::FeaturesManager()
{
    // Loading the lists of sequences

    // Two options:
    // 1) From the sequences extracted from the camera
    // 2) From the labelized trace file (computed with the network visualizer)

    ifstream fileListPersons("../../Data/OutputReid/trace_labelized.txt");

    if(!fileListPersons.is_open())
    {
        fileListPersons.open("../../Data/Traces/traces.txt");
        if(!fileListPersons.is_open())
        {
            cout << "Error: Impossible to load the trace file" << endl;
            exit(0);
        }
    }
    else
    {
        cout << "Labelized traces loaded !!!" << endl;
    }
<commit_msg>Correct the name of the input traces file<commit_after>#include "featuresmanager.h"

#include <functional>
#include <fstream>
#include "exchangemanager.h"
#include "features.h"

static const unsigned int MIN_SEQUENCE_SIZE = 5; // Otherwise, the sequence is ignored

bool replace(std::string &str, const std::string &from, const std::string &to)
{
    size_t start_pos = str.find(from);
    if(start_pos == std::string::npos)
        return false;
    str.replace(start_pos, from.length(), to);
    return true;
}

FeaturesManager::FeaturesManager()
{
    // Loading the lists of sequences

    // Two options:
    // 1) From the sequences extracted from the camera
    // 2) From the labelized trace file (computed with the network visualizer)

    ifstream fileListPersons("../../Data/OutputReid/traces_labelized.txt");

    if(!fileListPersons.is_open())
    {
        fileListPersons.open("../../Data/Traces/traces.txt");
        if(!fileListPersons.is_open())
        {
            cout << "Error: Impossible to load the trace file" << endl;
            exit(0);
        }
    }
    else
    {
        cout << "------------------------------------------------------------------" << endl;
        cout << "------WARNING: LABELLED TRACES FILE DETECTED AND USED !!!!!!------" << endl;
        cout << "------------------------------------------------------------------" << endl;
    }

{'fraction_non_alphanumeric': 0.18441971383147854, 'fraction_numerical': 0.003179650238473768, 'mean_word_length': 2.320580474934037, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 7, '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': '2937704', 'n_tokens_mistral': 745, 'n_tokens_neox': 726, 'n_words': 195}