<commit_before><?php
namespace core;

/**
 * Parse content-type
 */
class Convert {
  // Parse CSV into associated array
  public static function csv($str) {
    $fp = fopen("php://temp", 'r+');
    fputs($fp, $str);
    rewind($fp);

    $lines = [];
    $kv = fgetcsv($fp);
    while ( ($data = fgetcsv($fp) ) !== FALSE ) {
      $out = [];
      foreach ($data as $idx => $col) {
        $out[ trim($kv[$idx]) ] = trim($col);
      }
      $lines[] = $out;
    }
  }
}<commit_msg>Bugfix. Make CSV converter work<commit_after><?php
namespace core;

/**
 * Parse content-type
 */
class Convert {
  // Parse CSV into associated array
  public static function csv($str) {
    $fp = fopen("php://temp", 'r+');
    fputs($fp, $str);
    rewind($fp);

    $lines = [];
    $kv = fgetcsv($fp);
    while ( ($data = fgetcsv($fp) ) !== FALSE ) {
      $out = [];
      foreach ($data as $idx => $col) {
        $out[ trim($kv[$idx]) ] = trim($col);
      }
      $lines[] = $out;
    }
    return $lines;
  }
}
{'fraction_non_alphanumeric': 0.2123629112662014, 'fraction_numerical': 0.0, 'mean_word_length': 2.3691275167785233, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '592118', 'n_tokens_mistral': 364, 'n_tokens_neox': 355, 'n_words': 86}