<commit_before><?php

function display_field($object, $fieldName) {
    if (is_null($object)) {
        echo '';
        return;
    }
    echo (!is_null($object->$fieldName)) ? $object->$fieldName : '';
}

function escape_string_for_latex($string) {
    $disp = str_replace("&#039;", "'", $string);
    $disp = str_replace("&amp;", "\&", $disp);
    $disp = str_replace("&", "\&", $disp);
    $disp = str_replace("%", "\%", $disp);
    return $disp;
}

function display_latex_string($string, $sep = '', $limit = null) {
    $disp = escape_string_for_latex($string);
    
    if (!$limit && $sep == '')
        return $disp;
    
    if (!$sep)
        $disp = str_replace($sep, "\\\\", $disp);
    $len = strlen($disp);
    if ($limit!=null && $len > $limit) {
        $d = substr($disp, 0, $limit);
        $pos = strrpos($d, ' ');        
        if ($pos !== FALSE) {
            $disp = substr($d, 0, $pos) . " \\\\ " . substr($disp, $pos, $len);
        }
    }  
    return $disp;
}
<commit_msg>correction pour la generation des DS => le &amp; est transformé en & et non \& car reconverti ensuite (protection latex caractère spéciaux)<commit_after><?php

function display_field($object, $fieldName) {
    if (is_null($object)) {
        echo '';
        return;
    }
    echo (!is_null($object->$fieldName)) ? $object->$fieldName : '';
}

function escape_string_for_latex($string) {
    $disp = str_replace("&#039;", "'", $string);
    $disp = str_replace("&amp;", "&", $disp);
    $disp = str_replace("&", "\&", $disp);
    $disp = str_replace("%", "\%", $disp);
    return $disp;
}

function display_latex_string($string, $sep = '', $limit = null) {
    $disp = escape_string_for_latex($string);
    
    if (!$limit && $sep == '')
        return $disp;
    
    if (!$sep)
        $disp = str_replace($sep, "\\\\ ", $disp);
    $len = strlen($disp);
    if ($limit!=null && $len > $limit) {
        $d = substr($disp, 0, $limit);
        $pos = strrpos($d, ' ');        
        if ($pos !== FALSE) {
            $disp = substr($d, 0, $pos) . "\\\\ " . substr($disp, $pos, $len);
        }
    }  
    return $disp;
}

{'fraction_non_alphanumeric': 0.2207609206200094, 'fraction_numerical': 0.004697040864255519, 'mean_word_length': 2.5440931780366056, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '5189200', 'n_tokens_mistral': 752, 'n_tokens_neox': 745, 'n_words': 155}