Ejemplo n.º 1
0
 function mark(array $users)
 {
     $counters = array();
     $in = fopen(ConfPath::statusList(), 'r');
     $out = fopen(ConfPath::statusListMarked(), 'w');
     while ($line = fgets($in)) {
         $line = rtrim($line);
         $cells = mb_split(',', $line);
         $uid = $cells[self::UID_COL];
         if ($users[$uid]) {
             $line .= "," . $users[$uid];
             $counters[$users[$uid]]++;
         }
         fwrite($out, $line . "\n");
     }
     fclose($in);
     fclose($out);
     var_dump($counters);
 }
Ejemplo n.º 2
0
        if (!is_array($mecab) || count($mecab) == 0) {
            return;
        }
        $numbers = array();
        foreach ($mecab as $item) {
            if ($item['keyword']) {
                $numbers[] = $item['keyword'];
            }
        }
        fprintf($this->file, "%s,%d,%d,%s\n", $info['id'], $info['user_id'], $info['reply_to'], implode(",", $numbers));
    }
    public function close()
    {
        fclose($this->file);
    }
}
$table = KeywordsTable::singleton();
$table->loadTable(ConfPath::keywords());
$loader = new TwitterLog();
$numbering = new Numbering();
$numbering->open(ConfPath::statusList());
foreach (glob(ConfPath::rawStatusList()) as $path) {
    $loader->open($path);
    while ($loader->read1Line()) {
        $info = $loader->getArrayPassedMecab();
        $mecab = $table->addKeywordIntoMecabInfo($info['mecab']);
        $numbering->write1Line($info, $mecab);
    }
    $loader->close();
}
$numbering->close();