예제 #1
0
$fsaa = new Fsaa('../dict/lort_acc_full.fsa');
$fsas = new Fsas('../dict/lort_acc_full.fsa');
$fsal = new Fsal('../dict/llems_full.fsa');
$pspell_config = pspell_config_create("pl");
pspell_config_ignore($pspell_config, 4);
pspell_config_mode($pspell_config, PSPELL_FAST);
pspell_config_runtogether($pspell_config, false);
$pspell_link = pspell_new_config($pspell_config);
// uruchomienie stopera, rozpoczêcie zbierania danych czasowych
$stoper = new Timer();
// pobierz zbiór wyników
$res = $db->query("SELECT * FROM comment_{$cfg_tab} WHERE type = 'OK' ORDER BY id");
while ($row = $res->fetch_row()) {
    list($id, $comment, $type) = $row;
    //echo $comment;
    $stoper->set('query');
    // sprawdzenie email i WWW
    if (Validation::findEmail($comment) || Validation::findWWW($comment)) {
        echo 'E' . $id . '--' . $comment . '===' . implode(', ', $tok_comment) . "\n";
        $stoper->set('email');
        continue;
    }
    $stoper->set('email');
    // docelowa tablica s³ów
    $tok_comment = array();
    // tokenizacja
    $tok_comment1 = $tokenizer->tokenize($comment);
    // zdjêcie informacji o potencjalnych wulgaryzmach
    $prop_vulg = intval(array_pop($tok_comment1));
    $stoper->set('tokens');
    /*  foreach ($tok_comment1 as $w) {
예제 #2
0
     }
 } else {
     foreach ($pclassifiers as $k => $v) {
         $classifiers[$k] = $v[$_POST['set']];
         if ($suppressThreshold) {
             $classifiers[$k]['threshold'] = 0.0;
         }
     }
 }
 // utwórz obiekty klasyfikatorów, obiekty czasomierzy a nastêpnie klasyfikuj
 foreach ($classifiers as $k => $v) {
     $tmpc = new ReflectionClass($k);
     $classObj[$k] = $tmpc->newInstance($db, $dictionaries, $_POST['set'], false, $v);
     $time = new Timer();
     if (is_null($prepText)) {
         $time->set('start');
         $prepText = $classObj[$k]->doPreparation($_POST['comment']);
         $time->set('doPreparation');
         $prepResult['time'] = '<b>' . $time->format($time->get('doPreparation')) . '</b>';
         if ($prepText === false) {
             break;
         }
     }
     $time->set('start');
     $results[$k] = $classObj[$k]->doClassify($prepText, true);
     $time->set('doClassify');
     $times[$k] = $time->format($time->get('doClassify'));
 }
 unset($classObj);
 $prepResult['org'] = $_POST['comment'];
 ?>