/** * Dokonuje zamiany wyrazu w wersji odmienionnej leksykalnie do wersji * pseudos³ownikowej, redukuj±c tym samym liczbê odmian wyrazu w zbiorze * cech. * * @param array $comment Tablica wyrazów do przeanalizowania. * @return array Tablica wyrazów lub false, je¶li nie ma wyrazów. */ protected function lematize(array $comment) { $tok_comment = array(); foreach ($comment as $w) { $temp = self::$fsal->lematize($w); if ($temp !== false) { $tok_comment = array_merge($tok_comment, $temp); } else { $tok_comment[] = $w; } } if (count($tok_comment) == 0) { return false; } return $tok_comment; }
require_once '../fsa/fsas-opt.php'; // konfiguracja // $cfg_serv = 'localhost'; $cfg_user = '******'; $cfg_pass = ''; $cfg_db = 'swk'; $cfg_tab = '3'; ////////////////// // po³±cz z baz± danych $db = DBHelper::connect($cfg_serv, $cfg_user, $cfg_pass, $cfg_db); // zainicjalizuj pozosta³e klasy $validation = new Validation('../dict/vulgarism.txt'); $tokenizer = new Tokenizer('../dict/stoplist.txt'); $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)) {