<commit_before>#include <bits/stdc++.h>
#include "../include/hmm.h"

using namespace std;

HMM::HMM () // constructor with random generated parameters
{
    this -> n = 133;
    this -> m = 20;

    // tags
    /*
    1 - i (in)
    2 - m (membrane)
    3 - o (out)
    */
    this -> tags = new int[n];
    int k = 0;
    // inloop 1-10 - i
    for (int i = 0; i < 10; i++)
        this -> tags[k++] = 1;
    // inglob - i
    this -> tags[k++] = 1;
    // inloop 11-20 - i
    for (int i = 0; i < 10; i++)
        this -> tags[k++] = 1;
    // cap - m
    for (int i = 0; i < 5; i++)
        this -> tags[k++] = 2;
    // helix - m
    for (int i = 0; i < 25; i++)
        this -> tags[k++] = 2;
    // cap - m
    for (int i = 0; i < 5; i++)
        this -> tags[k++] = 2;
    // short loop 1-10 - o
    for (int i = 0; i < 10; i++)
        this -> tags[k++] = 3;
    // outglob - o
    this -> tags[k++] = 3;
    // short loop 11-20 - o
    for (int i = 0; i < 10; i++)
        this -> tags[k++] = 3;
    // long loop 1-10 - o
    for (int i = 0; i < 10; i++)
        this -> tags[k++] = 3;
    // out glob - o
    this -> tags[k++] = 3;
    // long loop 11-20 - o
    for (int i = 0; i < 10; i++)
        this -> tags[k++] = 3;
    // cap - m
    for (int i = 0; i < 5; i++)
        this -> tags[k++] = 2;
    // helix - m
    for (int i = 0; i < 25; i++)
        this -> tags[k++] = 2;
    // cap - m
    for (int i = 0; i < 5; i++)
        this -> tags[k++] = 2;

    // pi; always starts with a loop
    this -> pi = new double[n];
    for (int i = 0; i < n; i++)
    {
        this -> pi[i] = 0.0;
    }
    pi[0] = 1 + rand() % 100;
    pi[56] = 1 + rand() % 100;
    pi[77] = 1 + rand() % 100;
    double sum = pi[0] + pi[56] + pi[77];
    pi[0] /= sum;
    pi[56] /= sum;
    pi[77] /= sum;

    // T; it is known in advance which field of matrix is 0
    this -> T = new double*[n];
    for (int i = 0; i < n; i++)
    {
        this -> T[i] = new double[n];
        for (int j = 0; j < n; j++)
        {
            this -> T[i][j] = 0.0;
        }
        this -> T[i][(i+1)%n] = 1 + rand() % 100;
    }
    this -> T[76][98] = this -> T[76][77];
    this -> T[76][77] = 0.0;
    this -> T[55][77] = 1 + rand() % 100;

    // inloop 1-10 - i
    for (int i = 0; i < 10; i++)
    {
        this -> T[i][20 - i] = 1 + rand() % 100;
        this -> T[i][21 - i] = 1 + rand() % 100;
    }
    // inglob - i
    this -> T[10][10] = 1 + rand() % 100;
    // inloop 11-20 - i
    // cap - m
    // helix - m
    for (int i = 30; i <= 49; i++)
    {
        this -> T[28][i] = 1 + rand() % 100;
    }
    // cap - m
    // short loop 1-10 - o
    for (int i = 0; i < 10; i++)
    {
        this -> T[i + 56][56 + 20 - i] = 1 + rand() % 100;
        this -> T[i + 56][56 + 21 - i] = 1 + rand() % 100;
    }
    T[56][98] = T[56][77];
    T[56][77] = 0.0;
    // outglob - o
    this -> T[66][66] = 1 + rand() % 100;
    // short loop 11-20 - o
    // long loop 1-10 - o
    for (int i = 0; i < 10; i++)
    {
        this -> T[i + 77][77 + 20 - i] = 1 + rand() % 100;
        this -> T[i + 77][77 + 21 - i] = 1 + rand() % 100;
    }
    // out glob - o
    this -> T[87][87] = 1 + rand() % 100;
    // long loop 11-20 - o
    // cap - m
    // helix - m
    for (int i = 107; i <= 126; i++)
    {
        this -> T[105][i] = 1 + rand() % 100;
    }
    // cap - m

    sum = 0.0;
    for (int i = 0; i < n; i++)
    {
        sum = 0.0;
        for (int j = 0; j < n; j++)
            sum+= T[i][j];
        for (int j = 0; j < n; j++)
            this -> T[i][j] /= sum;
    }

    // O<commit_msg>fixed constructor<commit_after>#include <bits/stdc++.h>
#include "../include/hmm.h"

using namespace std;

HMM::HMM () // constructor with random generated parameters
{
    this -> n = 133;
    this -> m = 20;

    // tags
    /*
    1 - i (in)
    2 - m (membrane)
    3 - o (out)
    */
    this -> tags = new int[n];
    int k = 0;
    // inloop 1-10 - i
    for (int i = 0; i < 10; i++)
        this -> tags[k++] = 1;
    // inglob - i
    this -> tags[k++] = 1;
    // inloop 11-20 - i
    for (int i = 0; i < 10; i++)
        this -> tags[k++] = 1;
    // cap - m
    for (int i = 0; i < 5; i++)
        this -> tags[k++] = 2;
    // helix - m
    for (int i = 0; i < 25; i++)
        this -> tags[k++] = 2;
    // cap - m
    for (int i = 0; i < 5; i++)
        this -> tags[k++] = 2;
    // short loop 1-10 - o
    for (int i = 0; i < 10; i++)
        this -> tags[k++] = 3;
    // outglob - o
    this -> tags[k++] = 3;
    // short loop 11-20 - o
    for (int i = 0; i < 10; i++)
        this -> tags[k++] = 3;
    // long loop 1-10 - o
    for (int i = 0; i < 10; i++)
        this -> tags[k++] = 3;
    // out glob - o
    this -> tags[k++] = 3;
    // long loop 11-20 - o
    for (int i = 0; i < 10; i++)
        this -> tags[k++] = 3;
    // cap - m
    for (int i = 0; i < 5; i++)
        this -> tags[k++] = 2;
    // helix - m
    for (int i = 0; i < 25; i++)
        this -> tags[k++] = 2;
    // cap - m
    for (int i = 0; i < 5; i++)
        this -> tags[k++] = 2;

    // pi; always starts with a loop
    this -> pi = new double[n];
    for (int i = 0; i < n; i++)
    {
        this -> pi[i] = 0.0;
    }
    pi[0] = 1 + rand() % 100;
    pi[56] = 1 + rand() % 100;
    pi[77] = 1 + rand() % 100;
    double sum = pi[0] + pi[56] + pi[77];
    pi[0] /= sum;
    pi[56] /= sum;
    pi[77] /= sum;

    // T; it is known in advance which field of matrix is 0
    this -> T = new double*[n];
    for (int i = 0; i < n; i++)
    {
        this -> T[i] = new double[n];
        for (int j = 0; j < n; j++)
        {
            this -> T[i][j] = 0.0;
        }
        this -> T[i][(i+1)%n] = 1 + rand() % 100;
    }
    this -> T[76][98] = this -> T[76][77];
    this -> T[76][77] = 0.0;
    this -> T[55][77] = 1 + rand() % 100;

    // inloop 1-10 - i
    for (int i = 0; i < 10; i++)
    {
        this -> T[i][20 - i] = 1 + rand() % 100;
        this -> T[i][21 - i] = 1 + rand() % 100;
    }
    // inglob - i
    this -> T[10][10] = 1 + rand() % 100;
    // inloop 11-20 - i
    // cap - m
    // helix - m
    for (int i = 30; i <= 49; i++)
    {
        this -> T[28][i] = 1 + rand() % 100;
    }
    // cap - m
    // short loop 1-10 - o
    for (int i = 0; i < 10; i++)
    {
        this -> T[i + 56][56 + 20 - i] = 1 + rand() % 100;
        this -> T[i + 56][56 + 21 - i] = 1 + rand() % 100;
    }
    this -> T[56][98] = this -> T[56][77];
    this -> T[56][77] = 0.0;
    // outglob - o
    this -> T[66][66] = 1 + rand() % 100;
    // short loop 11-20 - o
    // long loop 1-10 - o
    for (int i = 0; i < 10; i++)
    {
        this -> T[i + 77][77 + 20 - i] = 1 + rand() % 100;
        this -> T[i + 77][77 + 21 - i] = 1 + rand() % 100;
    }
    // out glob - o
    this -> T[87][87] = 1 + rand() % 100;
    // long loop 11-20 - o
    // cap - m
    // helix - m
    for (int i = 107; i <= 126; i++)
    {
        this -> T[105][i] = 1 + rand() % 100;
    }
    // cap - m

    sum = 0.0;
    for (int i = 0; i < n; i++)
    {
        sum = 0.0;
        for (int j = 0; j < n; j++)
            sum+= this -> T[i][j];
        for (int j = 0; j < n; j++)
            this -> T[i][j] /= sum;
    }

    // O
{'fraction_non_alphanumeric': 0.22550372619376208, 'fraction_numerical': 0.07976814794369307, 'mean_word_length': 1.2367283950617285, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 89, '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': '7462086', 'n_tokens_mistral': 3446, 'n_tokens_neox': 2959, 'n_words': 970}