<commit_before><?php
/* This class is part of the XP framework
 *
 * $Id$ 
 */

  /**
   * (Insert class' description here)
   *
   * @ext      extension
   * @see      reference
   * @purpose  purpose
   */
  class PNode extends Object {
    var
      $type= '',
      $args= array();
    
    function stringOf($a, $indent= '') {
      if (is_array($a)) {
        if (is_int(key($a))) {
          $s= "[\n";
          foreach ($a as $v) {
            $s.= $indent.'  - '.PNode::stringOf($v, $indent.'  ').",\n";
          }
          return $s.$indent.']';
        } else {
          $s= "{\n";
          foreach ($a as $k => $v) {
           $s.= $indent.'  - '.$k.' => '.PNode::stringOf($v, $indent.'  ').",\n";
         }
          return $s.$indent.'}';
       }
      }
      if (is_a($a, 'PNode')) {
        return str_replace("\n", "\n".$indent, $a->toString());
      }
      return xp::stringOf($a);
    }
    
    function &create($type, $args) {
      $n= &new PNode();
      $n->type= $type;
      
      for ($i= 0, $s= sizeof($args); $i < $s; $i++) {
        if (is_a($args[$i], 'PNode')) {
          // $args[$i]->parent= $n;
          $n->args[$i]= $args[$i];
        } else {
          $n->args[$i]= $args[$i];
        }
      }

      // Console::writeLine('+ '.$n->toString());
      return $n;
    }
    
    function toString() {
      return (
        $this->type.'Node('.implode(', ', array_map(array(&$this, 'stringOf'), $this->args)).')'
        // '@{'.
        // ($this->parent ? 'parent= *->'.$this->parent->type.'Node' : 'top').
        // '}'
      );<commit_msg>- Remove __id member during serialization<commit_after><?php
/* This class is part of the XP framework
 *
 * $Id$ 
 */

  /**
   * (Insert class' description here)
   *
   * @ext      extension
   * @see      reference
   * @purpose  purpose
   */
  class PNode extends Object {
    var
      $type= '',
      $args= array();
    
    function stringOf($a, $indent= '') {
      if (is_array($a)) {
        if (is_int(key($a))) {
          $s= "[\n";
          foreach ($a as $v) {
            $s.= $indent.'  - '.PNode::stringOf($v, $indent.'  ').",\n";
          }
          return $s.$indent.']';
        } else {
          $s= "{\n";
          foreach ($a as $k => $v) {
           $s.= $indent.'  - '.$k.' => '.PNode::stringOf($v, $indent.'  ').",\n";
         }
          return $s.$indent.'}';
       }
      }
      if (is_a($a, 'PNode')) {
        return str_replace("\n", "\n".$indent, $a->toString());
      }
      return xp::stringOf($a);
    }
    
    function &create($type, $args) {
      $n= &new PNode();
      $n->type= $type;
      
      for ($i= 0, $s= sizeof($args); $i < $s; $i++) {
        if (is_a($args[$i], 'PNode')) {
          // $args[$i]->parent= $n;
          $n->args[$i]= $args[$i];
        } else {
          $n->args[$i]= $args[$i];
        }
      }

      // Console::writeLine('+ '.$n->toString());
      return $n;
    }
    
    function __sleep() {
      return array('type', 'args');
    }
    
    function toString() {
      return (
        $this->type.'Node('.implode(', ', array_map(array(&$this, 'stringOf'), $this->args)).')'
        // '@{'.
        // ($this->parent ? 'parent= *->'.$this->parent->type.'Node' : 'top').
        // '}'
      );
{'fraction_non_alphanumeric': 0.2396719319562576, 'fraction_numerical': 0.0006075334143377885, 'mean_word_length': 1.570647931303669, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 31, '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': '2880957', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1158, 'n_words': 238}