<commit_before><?php
function imc_parse_text($str,$obj){
  preg_match_all("|%(.*)%|U", $str, $match, PREG_PATTERN_ORDER);
  foreach($match[1] AS $field){
    if(!isset($obj[$field])){
      echo '<p  style="color:red"><b>ParseError</b>: Field <b>'.$field.'</b> not found on object <b>'.get_class($obj)."</b>.</p>";
      $str = str_replace('%'.$field.'%','',$str);
    }else{
      $str = str_replace('%'.$field.'%',$obj[$field],$str);
    }
  }
  
  preg_match_all("|#(.*)#|U", $str, $match, PREG_PATTERN_ORDER);
  foreach($match[1] AS $function){
    if(!is_null($obj->$function()->__toString()))
      $str = str_replace('#'.$function.'#',$obj->$function(),$str);
    else
      $str = str_replace('#'.$function.'#','',$str);
  }
  
  return html_entity_decode($str);
}<commit_msg>Fix del fix anterior<commit_after><?php
function imc_parse_text($str,$obj){
  preg_match_all("|%(.*)%|U", $str, $match, PREG_PATTERN_ORDER);
  foreach($match[1] AS $field){
    if(!isset($obj[$field])){
      echo '<p  style="color:red"><b>ParseError</b>: Field <b>'.$field.'</b> not found on object <b>'.get_class($obj)."</b>.</p>";
      $str = str_replace('%'.$field.'%','',$str);
    }else{
      $str = str_replace('%'.$field.'%',$obj[$field],$str);
    }
  }
  
  preg_match_all("|#(.*)#|U", $str, $match, PREG_PATTERN_ORDER);
  foreach($match[1] AS $function){
    if(!is_object($obj->$function()) || (is_object($obj->$function()) && method_exists($obj->$function(),'__toString') && !is_null($obj->$function()->__toString())))
      $str = str_replace('#'.$function.'#',$obj->$function(),$str);
    else
      $str = str_replace('#'.$function.'#','',$str);
  }
  
  return html_entity_decode($str);
}
{'fraction_non_alphanumeric': 0.280307510348906, 'fraction_numerical': 0.002365464222353637, 'mean_word_length': 4.735593220338983, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 28, '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': '3937024', 'n_tokens_mistral': 649, 'n_tokens_neox': 653, 'n_words': 88}